Boolean state not setting instantly for respawn

0 favourites
  • 3 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.
  • Hi guys, been stalking for a little while, recently bought the engine and LOVE every bit of it

    but I've encountered a bit of an issue

    basically my project requires the player to be in one of several states

    Default (running around with platform controller)

    Ladder (climbing a ladder and jumping off it into default state)

    Death (plays death animation then waits before running respawn state)

    Respawn (after the player dies, reset position, reset states and take away life)

    now, the issue I seem to have is between death state and respawn

    first issue is that the animation loops despite it not looping (I suspect that has to do with other issues)

    the major problem is that upon respawn, despite it setting the respawn state to false, resets position for a period of time making the character jitter in place

    I'm using BOOL variables as flags to indicate what 'state' the player should be in and it appears it takes time for a bool state to change

    and this is an issue I don't know how to fix

    Thanks for your time and i hope you can help or explain a better method or why its doing this, I fear it maybe an issue with 'ticks' but the difference shouldn't be this obvious

    <img src="http://i81.photobucket.com/albums/j205/DIGI_Byte/construct_respawn_glitch.jpg" border="0" />

  • From what I can see, you're not setting Died to false so that condition will be met for 2 seconds and will keep replaying the animation "Death".

    It should be...

    + Is Died

    • Set animation to Death (play from beginning)
    • Set Died to False
    • Wait 2 seconds
    • Set Respawn to True

    OR another way is to add a "Trigger Once While True" condition to Is Died..

    + Is Died

    + Trigger Once While True

    • Set animation to "Death"
    • Wait 2 seconds
    • Set Respawn to True
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • fixed the order of some commands, also, Trigger once is a God sent blessing, thank you

    ps, I'm not religious

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