Slow down time when doing an action ?

Community Forums/General Help/Slow down time when doing an action ?

RemiD(Posted 2013) [#1]
Hello,

I wonder how to code a routine to slow down time when a character is doing an action.

For example, i want to be able to slow down time when the main character is trying to hit/dodge an enemy, so that the program asks the player to type a combination of keys and if the player manages to type the right combination, a special move is done (attack or defense/dodge) else nothing is done (miss attack or miss defense/dodge)

Do you have any idea on how to code this ? If yes, can you please explain the concepts ?

Thanks,


Kryzon(Posted 2013) [#2]
Update everything based on a scalar (a simple value, a factor). This includes animation interpolations, node transformations etc.
This works just like that delta-time technique used for controlling the speed of your game.

However, the scalar used with delta-time (called the "delta factor") is calculated based on the frame rate of your game.

In your case, you would manipulate this scalar to achieve the effect you want (i.e: quadratically lower it, keep it low while the player tries the key combo, then quadratically raise it back up).


RemiD(Posted 2013) [#3]
Thanks for the idea Kryzon.

So if i understand correctly, it can be as simple as storing a state for example SlowMotionState (int)

And if SlowMotionState is 0 (Off), the program uses the last calculated delta time value, and if SlowMotionState is 1 (On), the program uses the last calculated delta time value divided by 2 (or more).
Then each movement, rotation, animation must be multplied by this new delta time value and the slow motion magic will operate.

I think i get it.

Thanks again.