[4.5.9] Brawler - player won't stop moving when attacking

offparkway

Active member
Howdy!

In the brawler module, button B punches. My player stops movement while punching, and then continues. Great.

I copied the punch script (only changing the action step number) and assigned it to button A for a kick animation. It works, and my player kicks. Looks good. But he won't stop moving when he kicks, which leaves the "foot" object behind until it destroys.

The scripts for punching and kicking are identical, so I'm at a loss. Anyone know why the "StopMoving" line of code works for the punch, but not the kick?

(I do have button A also set to activate NPC text as well. I thought maybe that was causing problems, so I removed the NPC function. But it made no difference).

Here's the kick script:
Code:
TXA
    STA temp ;; assumes the object that we want is in x.

    GetActionStep temp
  
    CMP #$03 ;; is it already kicking?
    BNE +canKick
        ;; wait until we're back to idle to kick again.
        RTS
    +canKick
    ChangeActionStep temp, #$03 ;; assumes that "kick" is in action 3
    ;arg0 = what object?
    ;arg1 = what behavior?
    StopMoving temp, #$FF, #$00
  
  

        WEAPON_POSITION_RIGHT_X = #$10
        WEAPON_POSITION_RIGHT_Y = #$08

        WEAPON_POSITION_LEFT_X = #$F8
        WEAPON_POSITION_LEFT_Y = #$08
        WEAPON_OBJECT = #$08
        WEAPON_RIGHT_STATE = #$00
        WEAPON_LEFT_STATE = #$01

      
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ;; 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
        
                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_screen,x
                ADC #$00
                STA tempD
              
                LDA Object_y_hi,x
                CLC
                ADC #WEAPON_POSITION_RIGHT_Y
                STA tempB
            
                LDA #WEAPON_OBJECT
                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.
                   CreateObjectOnScreen tempA, tempB, tempC, #WEAPON_RIGHT_STATE, tempD
                   LDA #%11000000
                   STA Object_direction,x
                   JMP +doneWithCreatingWeapon
            +notRight
          
                ;;; CREATE LEFT WEAPON
                LDX player1_object
                LDA Object_x_hi,x
                CLC
                ADC #WEAPON_POSITION_LEFT_X
                STA tempA
                LDA Object_screen,x
                SBC #$00
                STA tempD
                LDA Object_y_hi,x
                CLC
                ADC #WEAPON_POSITION_LEFT_Y
                STA tempB
              
                LDA #WEAPON_OBJECT
                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.
                   CreateObjectOnScreen tempA, tempB, tempC, #WEAPON_LEFT_STATE, tempD
                 LDA #%10000000
                 STA Object_direction,x
                 JMP +doneWithCreatingWeapon
            ;+notLeft
          
        +doneWithCreatingWeapon
  
    RTS
 

offparkway

Active member
@offparkway Any chance you were able to figure this out? I'm having the same issue when using 'A' as an alternative attack button. (Right fist punch)
I did figure it out. I’ll have to re-look at my game but I think a big part of it was adding a check in the physics script to ignore my kick state (03) like the punch is ignored. I’m sure I also have a StopMoving in my kick script as well.
 
Excited to hear back what your script looks like. Did you make a duplicate of the script with that change for action step 3 or can you have it work for both actions on the same script? I’ve almost sorted through my initial bugs before I can get deeper into building everything out.
 

offparkway

Active member
Excited to hear back what your script looks like. Did you make a duplicate of the script with that change for action step 3 or can you have it work for both actions on the same script? I’ve almost sorted through my initial bugs before I can get deeper into building everything out.
So in my physics script, I just added a portion to ignore the physics for my kick (after "+notPunch"):

;;;;;;;;;;;;;;;;;;;;;;;;;;; FOR BRAWLER PHYSICS
;;;;;;;;;;;;;;;;;;;;;;;;;;; DON'T UPDATE POSITIONING IF ATTACKING
CPX player1_object
BNE +notPlayer
;; it was the player.
;; if this object is in attack action, currently set to 2,
;; he should not move, and should skip physics check
TXA
STA temp
GetActionStep temp
CMP #$02 ;;is he punching?
BNE +notPunch ;; skip, because was not 2.
JMP skipPhysics

+notPunch

CMP #$03 ;is he kicking?
BNE +notKicking ;not kicking
JMP skipPhysics

+notKicking
 

offparkway

Active member
As for the input script, I just duplicated the punch script and for a kick and changed what I needed to in order to use the foot object I created. There’s a StopMoving in that.
 
Ok, so I started by adding the addition to the physics script where you said, changing verbiage from kicking to altpunch. Found that the +notPlayer needed to be left in there as well lol:

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;; FOR BRAWLER PHYSICS
;;;;;;;;;;;;;;;;;;;;;;;;;;; DON'T UPDATE POSITIONING IF ATTACKING  
    CPX player1_object
    BNE +notPlayer
        ;; it was the player.
        ;; if this object is in attack action, currently set to 2,
        ;; he should not move, and should skip physics check
        TXA
        STA temp
        GetActionStep temp
        CMP #$02
        BNE +notPlayer ;; skip, because was not 2.
            JMP skipPhysics
           
        +notPunch
           
        CMP #$03 ;is he kicking?punching with right fist?
        BNE +notAltPunch ;not AltPunch
            JMP skipPhysics

            +notAltPunch
   
        +notPlayer


I then went to the AltAttack script that I made from copying the attack script. This is where I made the change to get it to use the correct animation step for the input. However, when trying to make changes that would properly align the stop function, I got nothing. I reverted it back to the state it was in prior. Here is that script if you can see where I need to make that update for the stop moving to work?


Code:
;; if you would like unlockable weapons,
    ;; that will be created with the b button
    ;; use this code.


   

    TXA
    STA temp ;; assumes the object that we want is in x.

    GetActionStep temp
    CMP #$02 ;; is it already attacking?
    BNE +canAttack
        ;; wait until we're back to idle to attack again.
        RTS
    +canAttack
    ChangeActionStep temp, #$03 ;; assumes that "attack" is in action 3
    ;arg0 = what object?
    ;arg1 = what behavior?
    StopMoving temp, #$FF, #$00
   
   

        WEAPON_POSITION_RIGHT_X = #$10
        WEAPON_POSITION_RIGHT_Y = #$08

        WEAPON_POSITION_LEFT_X = #$F8
        WEAPON_POSITION_LEFT_Y = #$08
        WEAPON_OBJECT = #$01
        WEAPON_RIGHT_STATE = #$00
        WEAPON_LEFT_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
         
                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_screen,x
                ADC #$00
                STA tempD
               
                LDA Object_y_hi,x
                CLC
                ADC #WEAPON_POSITION_RIGHT_Y
                STA tempB
             
                LDA #WEAPON_OBJECT
                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.
                   CreateObjectOnScreen tempA, tempB, tempC, #WEAPON_RIGHT_STATE, tempD
                   LDA #%11000000
                   STA Object_direction,x
                   JMP +doneWithCreatingWeapon
            +notRight
           
                ;;; CREATE LEFT WEAPON
                LDX player1_object
                LDA Object_x_hi,x
                CLC
                ADC #WEAPON_POSITION_LEFT_X
                STA tempA
                LDA Object_screen,x
                SBC #$00
                STA tempD
                LDA Object_y_hi,x
                CLC
                ADC #WEAPON_POSITION_LEFT_Y
                STA tempB
               
                LDA #WEAPON_OBJECT
                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.
                   CreateObjectOnScreen tempA, tempB, tempC, #WEAPON_LEFT_STATE, tempD
                 LDA #%10000000
                 STA Object_direction,x
                 JMP +doneWithCreatingWeapon
            +notLeft
           
        +doneWithCreatingWeapon
       
    RTS
 
@offparkway reaching back out on this one. I keep coming back to this issue and trying new things with no luck. I’ve luckily made progress and worked through every other bug but this one. Physics are updated and I’ve done everything I can think of to change the AltAttack script to stop like the normal Attack.
 

offparkway

Active member
@offparkway reaching back out on this one. I keep coming back to this issue and trying new things with no luck. I’ve luckily made progress and worked through every other bug but this one. Physics are updated and I’ve done everything I can think of to change the AltAttack script to stop like the normal Attack.
Hey! Sorry, was preoccupied with the holidays and a new baby. Then stuck out of town due to storms. I’ll have to dig through and see what I did then… just haven’t had time. Off the top of my head I’m at a loss because I feel like that should’ve done it. Clearly I did something that worked, I just don’t remember where or what.
 
Ok, so I started by adding the addition to the physics script where you said, changing verbiage from kicking to altpunch. Found that the +notPlayer needed to be left in there as well lol:

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;; FOR BRAWLER PHYSICS
;;;;;;;;;;;;;;;;;;;;;;;;;;; DON'T UPDATE POSITIONING IF ATTACKING 
    CPX player1_object
    BNE +notPlayer
        ;; it was the player.
        ;; if this object is in attack action, currently set to 2,
        ;; he should not move, and should skip physics check
        TXA
        STA temp
        GetActionStep temp
        CMP #$02
        BNE +notPlayer ;; skip, because was not 2.
            JMP skipPhysics
          
        +notPunch
          
        CMP #$03 ;is he kicking?punching with right fist?
        BNE +notAltPunch ;not AltPunch
            JMP skipPhysics

            +notAltPunch
  
        +notPlayer


I then went to the AltAttack script that I made from copying the attack script. This is where I made the change to get it to use the correct animation step for the input. However, when trying to make changes that would properly align the stop function, I got nothing. I reverted it back to the state it was in prior. Here is that script if you can see where I need to make that update for the stop moving to work?


Code:
;; if you would like unlockable weapons,
    ;; that will be created with the b button
    ;; use this code.


  

    TXA
    STA temp ;; assumes the object that we want is in x.

    GetActionStep temp
    CMP #$02 ;; is it already attacking?
    BNE +canAttack
        ;; wait until we're back to idle to attack again.
        RTS
    +canAttack
    ChangeActionStep temp, #$03 ;; assumes that "attack" is in action 3
    ;arg0 = what object?
    ;arg1 = what behavior?
    StopMoving temp, #$FF, #$00
  
  

        WEAPON_POSITION_RIGHT_X = #$10
        WEAPON_POSITION_RIGHT_Y = #$08

        WEAPON_POSITION_LEFT_X = #$F8
        WEAPON_POSITION_LEFT_Y = #$08
        WEAPON_OBJECT = #$01
        WEAPON_RIGHT_STATE = #$00
        WEAPON_LEFT_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
        
                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_screen,x
                ADC #$00
                STA tempD
              
                LDA Object_y_hi,x
                CLC
                ADC #WEAPON_POSITION_RIGHT_Y
                STA tempB
            
                LDA #WEAPON_OBJECT
                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.
                   CreateObjectOnScreen tempA, tempB, tempC, #WEAPON_RIGHT_STATE, tempD
                   LDA #%11000000
                   STA Object_direction,x
                   JMP +doneWithCreatingWeapon
            +notRight
          
                ;;; CREATE LEFT WEAPON
                LDX player1_object
                LDA Object_x_hi,x
                CLC
                ADC #WEAPON_POSITION_LEFT_X
                STA tempA
                LDA Object_screen,x
                SBC #$00
                STA tempD
                LDA Object_y_hi,x
                CLC
                ADC #WEAPON_POSITION_LEFT_Y
                STA tempB
              
                LDA #WEAPON_OBJECT
                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.
                   CreateObjectOnScreen tempA, tempB, tempC, #WEAPON_LEFT_STATE, tempD
                 LDA #%10000000
                 STA Object_direction,x
                 JMP +doneWithCreatingWeapon
            +notLeft
          
        +doneWithCreatingWeapon
      
    RTS
good
 
Top Bottom