Search Unity

Best way to control 2D player event

Discussion in '2D' started by varjla, Sep 25, 2016.

  1. varjla

    varjla

    Joined:
    Mar 4, 2016
    Posts:
    1
    Hello!

    I need help with this:
    I'm doing a 2D game. and I have a "player" (roguelike). I can make the player moves, had an idle state, change between run and walk...

    But Now I have and "enjoyLargeIdle" state, when player do something stupid, like make 3 jumps, get his hat and play with it, spins around himself....etc

    I searched a lot of guilds on youtube, in this forums, and all over internet, but when I achieved the C# script start the event, the player runs the animation without stop. And if I change the loop option of the animation, the animation runs once, but player stopped.

    What I must do? Hope You can help me, please.
     
  2. absolute_disgrace

    absolute_disgrace

    Joined:
    Aug 28, 2016
    Posts:
    253
    Set a timestamp variable in your player script that gets updated when the play enters the idle state. You could then check against that timestamp versus now.