Stop time in my game

How i can stop time in my game?

Check this example: https://github.com/britzl/publicexamples/tree/master/examples/pause_game

Using set_time_step: http://www.defold.com/ref/collection-proxy/#set_time_step:factor-mode

2 Likes

I transformed your example and put in my project but nothing happened.


It works for me.

You have to understand what it is doing. It changes time rate in a collection proxy. If I understand right, it just alters frequency and dt’s values in update() callbacks and such, maybe does not call update() at all when zero.

So, you will want one “Loader” collection, that loads “Level1” or “Main” or whatever collection proxy, which you can then do stuff with such as changing time scale, pausing, nuking it completely and initialising again (very useful for restarting levels) etc.