[4.5.9] **UPDATED** Fall Animation - Platform Modules

smilehero65

Active member
Has it ever bothered you how every time the character falls from a place without pressing A, the running or idle animation still shows? :unsure:

before.gif

I just came up with a simple way to get around this.

EDIT: This method is far more optimized than my previous one! It also gets rid of a glitch I noticed where the player was not showing the fall animation when idle.


TUTORIAL:

1. I'm using the Simplified Inputs from baardbi (which I personally think it's the best way to handle Platformer inputs)


2. To make things easy, let's make our Jump State be our Falling State, which by default is Action 02.


3. Go to your Handle Physics Script and go to the label +notSolid: (in the standard platform module should be around Line 590)

Before the comment ;; is not solid, don't land. place this code:

Code:
;;;;;;;;;;;;;;;;;;;;;; FALLING ;;;;;;;;;;;;;;;;;;;;;

                    CPX player1_object        ;;;Check for Player
                    BNE +isPlayer
                    STX temp ;; assumes the object we want to move is in x.
                    GetActionStep temp
                    CMP #$02
                    BNE +isalreadyfalling    ;;;;is Player already in Fall State?
                        JMP doneFalling
                    +isalreadyfalling
                 
                        LDA Object_v_speed_lo,x ; load player's vertical movement speed
                        BPL +dothis
                        ChangeActionStep temp, #$02
                        JMP doneFalling
                        +dothis
                     
                    +isPlayer
             
                doneFalling:

4. In your Input Scripts, remember to disable the display of your idle and run animations when you're in fall state.

Here is an example of how my left input is set:

Code:
STX temp ;; assumes the object we want to move is in x.
    GetActionStep temp
    CMP #$07
    BNE +notHurt
        RTS
    +notHurt

 
        StartMoving temp, #LEFT
        STX temp ;; assumes the object we want to move is in x.
        ChangeFacingDirection temp, #FACE_LEFT
      
        GetActionStep temp
        CMP #1 ;Walk
        BEQ +
        CMP #2 ;Jump ---------ALSO MY FALL STATE
        BEQ +
            ChangeActionStep temp, #1 ;Change to walk state
        +
   
    RTS



5. Then you should be DONE! 😄😄😄

after.gif

Things to take into consideration:

  • Unfortunately, due to this little bug when colliding with the ground in a fall, the falling state shows in a brief second after touching the ground. The only way to fix this is by removing that bug, if that was possible, this code should still function.
  • Sorry if there are any errors in my explanation or process, it is my first tutorial and feedback is welcomed!

Feel free to correct me, ask me anything, or help me improve this!
**Credits to Mugi that gave the basis for this code in the thread: Jump/Fall? + Extras
 
Last edited:

smilehero65

Active member
Sadly, I really need a frame for the jump state and another one for the fall state.
Actually, you can change that.
You just need to change any mentions of action step $02 (jump state) to $04 (assuming that is your fall animation)

In your inputs also make sure that your animations will not be displayed if you're in Action Step $04

However, there is an extra step related to the landing because we need to declare that when the player touches the ground and it's in falling state it should go back to either iddle or running animation (I will be more detailed about it later as I am busy right now)

I think I should update my tutorial to make this more clear. Sorry the inconvenience.😅
 

claydragon44

New member
Thank you very much. You will understand why I want a different frame so much for the jump state and the fall state when I'll post a video about my Byte Off 4 demo entry in a few days.
 
Top Bottom