Stop while attacking? 4.5.6

WillElm

New member
I just want to make it so my character stops while attacking. In 4.1.5, I would just put something like this in my move left and right scripts, and this is basically how you could set up priority for your inputs:

Code:
    GetCurrentActionType player1_object
    STA temp 
    CMP #$03    
    BEQ ++ ;skip if we are attacking

Here is the move left script for the platformer module with my ideas how to stop while attacking. Any idea what I'm doing wrong? I tried it a few different ways. I feel like this should work though. "If the player is in Action Step 3, kill the script/don't move."

Code:
 TXA
 STA temp ;; assumes the object we want to move is in x.
    
 GetActionStep temp
 CMP #$03
 BEQ +attacking
    
GetActionStep temp
CMP #$07
BNE +notHurt
GetActionStep temp
CMP #$03
BNE +notHurt

RTS
+notHurt

 StartMoving temp, #LEFT
 TXA
 STA temp ;; assumes the object we want to move is in x.
 ChangeFacingDirection temp, #FACE_LEFT

 RTS
    
    +attacking
;;  StopMoving #$00, #$FF, #$00 ;; I shouldn't need this here but I tried it just in case
    RTS
 

crazygrouptrio

Active member
Not the platformer module but this works for adventure module, so I assume it should work. Hopefully it works for you or helps you in the right direction.
Code:
    TXA
    STA temp ;; assumes the object we want to move is in x.
    GetActionStep temp
    CMP #$02 ; attacking
    BEQ ++
    CMP #$01 ; walking
    BEQ +
   
    ChangeActionStep temp, #$01
    +

        StartMoving temp, #RIGHT
        TXA
        STA temp ;; assumes the object we want to move is in x.
        ChangeFacingDirection temp, #FACE_RIGHT
        ++
    RTS
 

WillElm

New member
crazygrouptrio said:
Not the platformer module but this works for adventure module, so I assume it should work. Hopefully it works for you or helps you in the right direction.
Code:
    TXA
    STA temp ;; assumes the object we want to move is in x.
    GetActionStep temp
    CMP #$02 ; attacking
    BEQ ++
    CMP #$01 ; walking
    BEQ +
   
    ChangeActionStep temp, #$01
    +

        StartMoving temp, #RIGHT
        TXA
        STA temp ;; assumes the object we want to move is in x.
        ChangeFacingDirection temp, #FACE_RIGHT
        ++
    RTS


Thanks! This didn't work, but I really feel like it should. However, I did manage to get the effect I want by selecting StopMoving with a timer in the action step for my attack. It's weird though that I didn't do that in 4.1.5, I wish I understood it.
 
Top Bottom