(SOLVED) Make an actor slide for 2 seconds problem

adytt

  • Posts: 51
Hello, to all, hope I can get a bit of help from someone more experienced as I got stuck on a behaviour I'm trying to build for a character.
So here is my problem:
I have a character to be used inside a running game: the controls are UP key - jump, X  key -fire, Down key - slide.
My  problem relates to sliding behavior in the following way.
As my character is set to continuoslly run by itself, Once I press the DOWN key I need the character to slide for 2 seconds, if the DOWN key is still being held preesed after the 2 seconds passed the character should get up automatically and continue with running animation.
If the DOWN key is released the character should automatically get up and continue running.
Once the DOWN key was released the character should be able to slide again etc.

My code works but not as aspected, I believe it's a timer related problem, so I kindly ask for some guidence in order to find a better way to build this behaviour.


« Last Edit: November 20, 2019, 11:42:55 am by adytt »

adytt

  • Posts: 51
Finaly managed to get it work like I wanted.
Many thanks to Photon for his outstanding tutorial featured on his blog: https://photongamedev.wordpress.com/2013/06/03/the-do-after-dilemma-building-your-own-time-tracking-mechanic/