1
General / Stun character
« on: April 01, 2018, 01:59:48 am »
What would be the best way for me to have my character stunned for 3 seconds. I used a boolean Stunned. So if the character is stunned, keyboard inputs won't work.
if(Stunned == false)
Player.playerMovement();
However, I can't seem to find a way to break out of the stunned once I make Stunned = true, nothing seems to work. I read up on the clock and time documentation but I still don't understand it.
I tried something like this.
Clock clock;
Time time;
clock.restart();
time = clock.getElaspedTime();
if (time.asSeconds() >= 3)
Stunned = false;
if(Stunned == false)
Player.playerMovement();
However, I can't seem to find a way to break out of the stunned once I make Stunned = true, nothing seems to work. I read up on the clock and time documentation but I still don't understand it.
I tried something like this.
Clock clock;
Time time;
clock.restart();
time = clock.getElaspedTime();
if (time.asSeconds() >= 3)
Stunned = false;