0 votes

How to regulate speed of my game? I want to add ability that makes time flow slower (like in The Matrix movie or Super Hot videogame) or even pause it? How to do it?

in Engine by (235 points)

2 Answers

+2 votes
Best answer

If you plan to have many different methods of time control as a central element of your game, such as in Braid, you will probably have to use a custom engine. (Either your own or Godot's code as a starting point.)

As the other person mentioned, you might be able to modify the Engine.time_scale value for a simple slowdown effect. You could even combine that with some other modifiers if you want the player character to move/act at "normal" speed during the slowdown.

Another option you could try that would give you more control over individual objects is to manipulate the delta value of the process and physics_process functions:
https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-method-physics-process

For example, modify the delta value for certain objects by a percentage determined by the player's movement speed in the case of Superhot.

by (856 points)
selected by
+2 votes

For simple things, you can try Engine.time_scale. Setting it to 1 means normal speed, to 0.1 means ten times slower, etc. For example

Engine.time_scale = 0.5

Makes the game run at half speed. However, i found that some collisions may show strange behaviours.. you should try and see if its enough for you.

BTW, according to reddit, this is what securas used in his github game off jam winner, Sealed Bite.

by (3,408 points)

i found that some collisions may show strange behaviours

Is it continuous collisions?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.