SOLVED (4.5.9.) Player animation stopped after attack input

5kids2feed

Well-known member
Weird thing I got going on.

If I have my player attack (press b) while holding the left or right button, his animation after the attack finishes will be "stopped" but he will move which ever direction i'm holding..

If I have my player attack.. while not holding left or right he will "go back to first" like I have it set to which is stopped. Then I press left or right and his animation will finally be the walking/moving animation.

Here is my attack code.. Any idea how to fix this so his animation will be moving in my first paragraph?:

Code:
    TXA
    STA temp ;; assumes the object we want to move is in x.
GetActionStep temp
    CMP #$02
    BNE +notHurt
        RTS
    +notHurt
    CMP #$07
    BNE +notHurt3
        RTS
    +notHurt3
    ;StopMoving temp, #$FF, #$00
    ChangeActionStep temp, #$02
 
    PlaySound #sfx_sharkattack
 
        LDX player1_object
        TXA
        STA temp
        GetObjectDirection temp ;; temp still observed from above.
       
                CMP #$02
                BNE +notRight
                ;;; CREATE RIGHT WEAPON
                LDX player1_object
                LDA Object_x_hi,x
                CLC
                ADC #$08 ;weapon right x
                STA tempA
                 LDA Object_screen,x
                ADC #$00
                STA tempD
             
                LDA Object_y_hi,x
                CLC
                ADC #$08 ;weapon right y
                STA tempB
           
                LDA #$02 ;weapon
                STA tempC
             
                   CreateObjectOnScreen tempA, tempB, tempC, #$00, tempD
                   LDA #%11000000
                   STA Object_direction,x
                   JMP +doneWithCreatingWeapon
                   +nocreate
                   JMP +doneWithCreatingWeapon
            +notRight
         
                ;;; CREATE LEFT WEAPON
                LDX player1_object
                LDA Object_x_hi,x
                CLC
                ADC #255 ;weapon left x
                STA tempA
                LDA Object_screen,x
                SBC #$00
                STA tempD
                LDA Object_y_hi,x
                CLC
                ADC #$08 ;weapon left y
                STA tempB
             
                LDA #$02 ;weapon
                STA tempC
                   CreateObjectOnScreen tempA, tempB, tempC, #$00, tempD
                 LDA #%10000000
                 STA Object_direction,x
                 JMP +doneWithCreatingWeapon
            +notLeft
         
        +doneWithCreatingWeapon

    RTS

P.S. I don't want after the attack end action to go to moving because he'll just sit there walking and it looks odd if i'm not pressing anything.
 
Last edited:

5kids2feed

Well-known member
Fixed it by making a custom end action script checking the player input.
But need to figure out why he moves back sometimes. I got it for the most part though and it’s not noticeable unless looking for it. Marking as solved.
 

5kids2feed

Well-known member
Code:
LDA gamepad
AND #%01000000 ;left
BEQ +skippy1a
ChangeActionStep player1_object, #$01
RTS
+skippy1a
LDA gamepad
AND #%10000000 ;right
BEQ +skippy2a
ChangeActionStep player1_object, #$01
RTS
+skippy2a
LDA gamepad
AND #%00100000 ;up
BEQ +skippy3a
ChangeActionStep player1_object, #$01
RTS
+skippy3a
LDA gamepad
AND #%00010000 ;down
BEQ +skippy4a
ChangeActionStep player1_object, #$01
RTS
+skippy4a
ChangeActionStep player1_object, #$00
    RTS

I made this right after userEnd0_action. Basically.. if you're holding any direction on the pad when the step is done it'll go to/repeat action step 1.. otherwise it'll go to action step 0. Works perfectly for me! You can remove the up and down inputs if you have them assigned to something else besides walking.
 

Sukotto42

Member
This was something I noticed was an issue in my game literally yesterday. I had planned to make a post to try to fix it. I couldn’t believe that the base functionality had that not working correctly. Anyway, looks like this has been solved, and was serendipitously posted while I was trying to think of a solution, so I will now file this under stuff I don’t have to casually occupy my mind with anymore! Thanks, @5kids2feed for the solution, and to @9Panzer for bumping this thread to the top so I could casually run into it!
 

5kids2feed

Well-known member
No problem! It’s little simple things like these that can deter you and frustrate you. I was just going for a simple solution and this is what I used in Carpet Shark. Glad it helps anyone else out with the same issue.
 

Lorenzo

New member
Thanks 5kids2feed for posting this, I'm having the same issue. Unfortunately when I tried your code it fixes the problem of the player moving in idle but it stops the attack animation from playing. I'm using NESmaker 4.5.9 with the adventure MOD. I'm really stuck on this.
 

offparkway

Active member
Code:
LDA gamepad
AND #%01000000 ;left
BEQ +skippy1a
ChangeActionStep player1_object, #$01
RTS
+skippy1a
LDA gamepad
AND #%10000000 ;right
BEQ +skippy2a
ChangeActionStep player1_object, #$01
RTS
+skippy2a
LDA gamepad
AND #%00100000 ;up
BEQ +skippy3a
ChangeActionStep player1_object, #$01
RTS
+skippy3a
LDA gamepad
AND #%00010000 ;down
BEQ +skippy4a
ChangeActionStep player1_object, #$01
RTS
+skippy4a
ChangeActionStep player1_object, #$00
    RTS

I made this right after userEnd0_action. Basically.. if you're holding any direction on the pad when the step is done it'll go to/repeat action step 1.. otherwise it'll go to action step 0. Works perfectly for me! You can remove the up and down inputs if you have them assigned to something else besides walking.
thank you! this has been an issue. I just tested this (in an input script, applying it when I release the A button) and it seems to solve my player "sliding" issue!
 

5kids2feed

Well-known member
Thanks 5kids2feed for posting this, I'm having the same issue. Unfortunately when I tried your code it fixes the problem of the player moving in idle but it stops the attack animation from playing. I'm using NESmaker 4.5.9 with the adventure MOD. I'm really stuck on this.
Aw, man. Bummer. You added it to your timer end scripts and not to your normal action script, right?
 
Top Bottom