How do I set "On jump" state when stomping Enemies?

0 favourites
  • 9 posts
From the Asset Store
State Machine
$10.99 USD
State Machine is a great tool for managing the state of anything in your game.
  • Supose that we are in a Super Mario style game. We are managing the Player (with Platform default controls enabled) and jump to stomp an Enemy.

    1) When the jump starts, Player is "On jump".

    2) Then he starts falling down and his state is "On fall".

    3) But then, he stomps the enemy and we "set Player vector Y to -n".

    4) Player is pushed up but his state hasn't changed, is going up while he thinks is still "On fall"

    5) When he reaches the max high and becomes falling again, he also doesn't know that hes falling for the second time cause he thinks that has been falling all the time.

    There is an option to solve this or a way to force a Platform object to know that it's "On jump" or other state?

  • If you're using the platform behavior, all of that functionality is built-in:

    https://www.scirra.com/manual/100/platform

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can use a boolean ("isJumping" for example) and put it true when jump and when he stomps the enemy.

    EDIT: Something like this:

  • Can't find a solution in the documentation .

    I can use the boolean, and activate it when he stomps the Enemy, but cannot activate a different boolean to check when he's falling again, cause is not possible to recognize when that event occurs since he already think is falling.

  • on fall play falling animation

    on jump play jumping animation

    if platform is falling

    trigger once--------------------------play falling animation

    if platform is jumping

    trigger once------------------------play jumping animation

  • Roccinio

    Hey! This is better than my example , thanks! Hahaha!

  • Seasky

    simplicity is bliss in programming! :p

    to be honest i had spend quite some time trying to figure this easy little thing by my own so please share the knowledge!

  • Roccinio, could you explain that again?. Cant understand it. Maybe im too novice...

    Remember that the main trouble is not with the animations themselves, i need to know if hes going up or down for different behaviors in game.

  • Ok. Understood

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)