[4.5.9] Holding B to Run

baardbi

Well-known member
So I used this a little differently. I wanted the bats in Frontiers to charge the player. I added a check against the bats action step instead of the players button. The bat starts at 1/3 speed, dives, and then when he changes to the action step that I want him to charge in the speed boost takes over :)

So if you are designing a monster that needs a speed boost for an attack this might be your solution!

Cool. Looks really nice.
 

mileco

Active member
If you want to use a more precise speed run, you could replace the
Code:
LDA tempA
ASL     ;; double the speed
STA tempA

With:
Code:
LDA tempA
CLC
ADC #16 ;; you can use any value here from 00 to 255 to adjust the running speed
STA tempA
This works amazing! Thanks, Dale.
 

baardbi

Well-known member
To speed up the animation speed as well as the movement speed you can modify the script doUpdateSpriteTimer.asm in ...\BASE_4_5\Game\Subroutines

At the beginning of doUpdateSpriteTimer.asm:
Code:
            DEC Object_animation_timer,x
           
            ;------------------------------------ Add this code block ------------------------------------------------
            ;; if holding B
            CPX player1_object
            BNE +skip   ;; if not the player object, we skip
                LDA gamepad
                AND #%00000010  ;; B button
                BEQ +skip
                    DEC Object_animation_timer,x
                    ;DEC Object_animation_timer,x  ;;; Uncomment this line to make the animation even faster.
            +skip:
            ;-------------------------------------------------------------------------------------------------------------
           

            LDA Object_animation_timer,x
            BEQ endOfAnimTimer
            BMI endOfAnimTimer ; <------------------------------- Add this line ----------------------------------
                JMP animationTimerNotFinished
            endOfAnimTimer:
 

dale_coop

Moderator
Staff member
To speed up the animation speed as well as the movement speed you can modify the script doUpdateSpriteTimer.asm in ...\BASE_4_5\Game\Subroutines

At the beginning of doUpdateSpriteTimer.asm:
Code:
            DEC Object_animation_timer,x
         
            ;------------------------------------ Add this code block ------------------------------------------------
            ;; if holding B
            CPX player1_object
            BNE +skip   ;; if not the player object, we skip
                LDA gamepad
                AND #%00000010  ;; B button
                BEQ +skip
                    DEC Object_animation_timer,x
                    ;DEC Object_animation_timer,x  ;;; Uncomment this line to make the animation even faster.
            +skip:
            ;-------------------------------------------------------------------------------------------------------------
         

            LDA Object_animation_timer,x
            BEQ endOfAnimTimer
            BMI endOfAnimTimer ; <------------------------------- Add this line ----------------------------------
                JMP animationTimerNotFinished
            endOfAnimTimer:
Good idea!
 

Gator

New member
Using this in the metrovania module & player has a shoot function. Everything working but when pressing b & direction it'll just slide. Need to figure out something like the release attack solution does to prevent that from happening with jump attacks.
 
Top Bottom