problem with change and state

0 favourites
  • 3 posts
From the Asset Store
State Machine
$9.90 USD
10% off
State Machine is a great tool for managing the state of anything in your game.
  • this is the code i have.

    what it does is when the enemy collides with the player attack he goes into a "takingDamage" state.

    when he enters the "takingDamage" state, i run once a tint on the enemy and after 1 second untint him and then exit the taking damage state by setting "takingDamage" to false.

    as soon as "takingDamage" is false he goes back to walking, being idle, etc.

    the problem is that if he gets hit again right as he is getting out of the "takingDamage" state (a specific moment between events maybe? where code hasnt been completed yet?)

    he sets the "takingDamage" to true again, but just stays stuck there, without running anything inside the "is takingDamage".

    since he doesnt run anything inside this condition he will be stuck there forever. (never setting "takingDamage" to false again)

    any ideas?

  • The "Trigger Once" event has (something like) a 10-second reset period. If your events are triggering faster than 10-seconds per event, only the first one will trigger.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • i switched the order of the 2 conditions, putting the "is takingDamage" before the "X is takingDamage".

    this seems to have solved the problem. cant seem to reproduce the "bug" anymore.

    anyone care to explain whats up??

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