I am trying to switch between menu and the level
but I found a problem ,in the level i have some factory to generate enemies, they will move towards the player.
the problem is when i call the menu ,the game needs to pause, i used set_time_step to pause the game, it seens worked but a little problem, the enemies already created can not stop moving to the player.
i dont know whats going on with it ,did I miss someting to do?
thanks
the code of collcection controller
function init(self)
msg.post(".","acquire_input_focus")
msg.post("/collections#gameplay","load")
end
function on_message(self, message_id, message, sender)
if message_id == hash("proxy_loaded") then
--msg.post(sender,"init")
msg.post(sender,"enable")
msg.post(sender,"acquire_input_focus")
end
end
function on_input(self, action_id, action)
if action_id == hash ("upgrade") and action.released then
msg.post("/collections#gameplay","set_time_step",{factor = 0, mode = 1})
msg.post("/collections#upgrade_gui","load")
end
end
I also record a video.
when i call the menu display,all the enemy was stop rotate but could not stop moving.
I print the dt value of the game collection and the square enemy ,they are all zero.
DEBUG:SCRIPT: update() with timestep (dt) 0
DEBUG:SCRIPT: SQUARE update() with timestep (dt) 0
The update function will still be called but as you can see from dt the time is not advancing. Aren’t you using dt when procedurally moving the enemies? go.animate would also not advance.