Animated to standing after attack while hold direction button. Adventure 4.5.6 (temp fix)

I learn how to attack from watching a Tutorial. The problem is if I am holding one of the directions,(Up, down, left and right) and press B button to attack. It show animated attack and it did hurt monsters. While I holding the direction, after attack animated complete, it wont change back to walking animated, it just standing animated sliding on the ground. I release the direction button to stop moving and change into standing animated, then press the direction buttons again to get walking animated to work. Is there a way to get walking animated to work right after attack animated complete while hold a direction button? Thanks.
 
ChangeToAttack_AdventureBase.asm

Code:
;; if you would like unlockable weapons, 
    ;; that will be created with the b button
    ;; use this code.
  
    LDA weaponsUnlocked
    BNE +canCreateWeapon
      LDY weaponChoice
      LDA weaponChoiceTable,y
      AND weaponsUnlocked
      BNE +canCreateWeapon
          RTS
    +canCreateWeapon
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   ;END UNLOCKABLE WEAPONS
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    TXA
    STA temp ;; assumes the object that we want is in x.

    ChangeActionStep temp, #$02 ;; assumes that "attack" is in action 2
    ;arg0 = what object?
    ;arg1 = what behavior?
    StopMoving temp, #$FF, #$00
    
    ;;; some constants for where to create the sword.
    ;;; Constants do not take up any memory.
        WEAPON_POSITION_RIGHT_X = #$0C
        WEAPON_POSITION_RIGHT_Y = #$06
        WEAPON_POSITION_UP_X = #$05
        WEAPON_POSITION_UP_Y = #$FA
        WEAPON_POSITION_DOWN_X = #$04
        WEAPON_POSITION_DOWN_Y = #$0F
        WEAPON_POSITION_LEFT_X = #$FC
        WEAPON_POSITION_LEFT_Y = #$08
        WEAPON_OBJECT = #$03
        WEAPON_RIGHT_STATE = #$01
        WEAPON_LEFT_STATE = #$03
        WEAPON_UP_STATE = #$02
        WEAPON_DOWN_STATE = #$00
        
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ;; Now, we have to create the object.
        ;; We will need to determine the direction
        ;; of the player.
        LDX player1_object
        TXA
        STA temp
        GetObjectDirection temp ;; temp still observed from above.
            ;;; this object's direction is now loaded into the 
            ;;; accumulator for comparison after the macro.
            ;; 0 = down
            ;; 1 = downright
            ;; 2 = right
            ;; 3 = upright
            ;; 4 = up
            ;; 5 = upleft
            ;; 6 = left
            ;; 7 = downleft
             BNE +notDown ;; jump if not equal to zero.
                ;;; CREATE DOWN WEAPON
                ;;; create an object for the weapon.
                ;;; create it at the down positions.
                ;;; create it with the down state
            
                LDX player1_object
                LDA Object_x_hi,x
                CLC
                ADC #WEAPON_POSITION_DOWN_X
                STA tempA
                LDA Object_y_hi,x
                CLC
                ADC #WEAPON_POSITION_DOWN_Y
                STA tempB
                LDY weaponChoice
                LDA weaponObjectTable,y
                STA tempC
               ;; use this is you want to always create a single object, based on
                   ;; the constant above.
                   ; CreateObject tempA, tempB, #WEAPON_OBJECT, #WEAPON_DOWN_STATE, currentNametable
                 
                   ;;; use this if you want to create a variable object based on 
                   ;;; the weaponChoice varaible.
                   CreateObject tempA, tempB, tempC, #WEAPON_DOWN_STATE, currentNametable
                   
                   LDA #%00110000
                 STA Object_direction,x
                 JMP +doneWithCreatingWeapon
            +notDown
                CMP #$02
                BNE +notRight
                ;;; CREATE RIGHT WEAPON
                LDX player1_object
                LDA Object_x_hi,x
                CLC
                ADC #WEAPON_POSITION_RIGHT_X
                STA tempA
                LDA Object_y_hi,x
                CLC
                ADC #WEAPON_POSITION_RIGHT_Y
                STA tempB
                    LDY weaponChoice
                LDA weaponObjectTable,y
                STA tempC
               ;; use this is you want to always create a single object, based on
                   ;; the constant above.
                   ; CreateObject tempA, tempB, #WEAPON_OBJECT, #WEAPON_RIGHT_STATE, currentNametable
                 
                   ;;; use this if you want to create a variable object based on 
                   ;;; the weaponChoice varaible.
                   CreateObject tempA, tempB, tempC, #WEAPON_RIGHT_STATE, currentNametable
                   LDA #%11000000
                   STA Object_direction,x
                   JMP +doneWithCreatingWeapon
            +notRight
            CMP #$04
            BNE +notUp
                ;;; CREATE UP WEAPON
                LDX player1_object
                LDA Object_x_hi,x
                CLC
                ADC #WEAPON_POSITION_UP_X
                STA tempA
                LDA Object_y_hi,x
                CLC
                ADC #WEAPON_POSITION_UP_Y
                STA tempB
                    LDY weaponChoice
                LDA weaponObjectTable,y
                STA tempC
               ;; use this is you want to always create a single object, based on
                   ;; the constant above.
                   ; CreateObject tempA, tempB, #WEAPON_OBJECT, #WEAPON_DOWN_STATE, currentNametable
                 
                   ;;; use this if you want to create a variable object based on 
                   ;;; the weaponChoice varaible.
                   CreateObject tempA, tempB, tempC, #WEAPON_UP_STATE, currentNametable
                 LDA #%00100000
                 STA Object_direction,x
                 JMP +doneWithCreatingWeapon
            +notUp
            CMP #$06
            BNE +notLeft
                ;;; CREATE LEFT WEAPON
                LDX player1_object
                LDA Object_x_hi,x
                CLC
                ADC #WEAPON_POSITION_LEFT_X
                STA tempA
                LDA Object_y_hi,x
                CLC
                ADC #WEAPON_POSITION_LEFT_Y
                STA tempB
                
                    LDY weaponChoice
                LDA weaponObjectTable,y
                STA tempC
               ;; use this is you want to always create a single object, based on
                   ;; the constant above.
                   ; CreateObject tempA, tempB, #WEAPON_OBJECT, #WEAPON_DOWN_STATE, currentNametable
                 
                   ;;; use this if you want to create a variable object based on 
                   ;;; the weaponChoice varaible.
                   CreateObject tempA, tempB, tempC, #WEAPON_LEFT_STATE, currentNametable
                 LDA #%10000000
                 STA Object_direction,x
                 JMP +doneWithCreatingWeapon
            +notLeft
            
        +doneWithCreatingWeapon  
      
    RTS
    
weaponChoiceTable:
    .db #%00000001, #%00000010, #%00000100, #%00001000
    .db #%00010000, #%00100000, #%01000000, #%10000000
    
    
weaponObjectTable:
    .db #$03, #$06, #$03, #$03, #$03, #$03, #$03, #$03

https://www.flickr.com/photos/190686562@N07/50504275341/in/dateposted-public/

First picture is Player Actions. Second picture is Weapon Bounding Box. Third picture is Weapon Action. (0 is down. 1 is right. 2 is up 3 is left.) Forth picture is Weapon Detail.

Update Edit: https://youtu.be/EQr6or3jF5Y
 
I add animated standing eyes blinking, and it turn out it won't animated into walking after attack while holding one of the direction buttons.
 
It is temporary fix. I change End Action to "Go To Previous" and It solve the problem doing attacking while holding one of the direction buttons. The problem is when not moving, if press attack button, after attack complete, it animated to walking while not moving.

https://www.flickr.com/photos/190686562@N07/50508128441/in/dateposted-public/

I need something like. If B button use, End Action set to "Go To First"(Standing animated) If B button use while holding one of the directions, End Action set to "Go To Previous"(Walking animated)
 

Lorenzo

New member
It is temporary fix. I change End Action to "Go To Previous" and It solve the problem doing attacking while holding one of the direction buttons. The problem is when not moving, if press attack button, after attack complete, it animated to walking while not moving.

https://flic.kr/p/2jXemUH View: https://www.flickr.com/photos/190686562@N07/50508128441/in/dateposted-public/


I need something like. If B button use, End Action set to "Go To First"(Standing animated) If B button use while holding one of the directions, End Action set to "Go To Previous"(Walking animated)
Hi Greg,

Thanks for posting this, I've been having the same issue and I just can't figure it out. Did you ever mange to solve this problem within the code?
 
Top Bottom