FlxTimer does not pause while pausing the game with substate.

348 views
Skip to first unread message

solewalker

unread,
Sep 27, 2014, 2:12:32 PM9/27/14
to haxef...@googlegroups.com
 I am using FlxTimer in my game extensively, mainly for killing or resetting objects after a certain interval, or playing animation after a timer period. It's been working so far. For pausing I am opening a substate. Everything was fine until I realize than while the game pauses FlxTimer does not pause, it's keeps running. Is it expected behavior from FlxTimer or I am doing something wrong? If it is default behavior, what should be the alternative? I am using timer in many places so pausing them manually is not an option.

I have noticed, when the cursor goes out of bound and default flixel pause screen pops up, only then the timer pauses.


Gama11

unread,
Sep 27, 2014, 4:46:08 PM9/27/14
to haxef...@googlegroups.com
If you don't need timers in your substate, you can do the following:

FlxTimer.manager.active = false;

The same applies to FlxTween and FlxPath.

solewalker

unread,
Sep 27, 2014, 5:02:13 PM9/27/14
to haxef...@googlegroups.com
It works for now. But it's a temporary hack, if I need to use timer in substate what to do? Use haxe timer?

Gama11

unread,
Sep 27, 2014, 5:04:58 PM9/27/14
to haxef...@googlegroups.com
Technically you can call update() on timers yourself. Not a very nice solution though.

With haxe timers you would have to manage cleaning them up when the substate is destroyed etc.

We are aware of this issue / limitation and it's one the todo-list for HaxeFlixel 4. There's a discussion about it here.

solewalker

unread,
Sep 27, 2014, 5:13:41 PM9/27/14
to haxef...@googlegroups.com
Okay, I can live with it for now. Flixel definitely needs a flexible timer or clock system. Unity has co-routine or Invoke, cocos2d has scheduler, another engine I used, ORX had really cool clock system, so I could slow down or increase update call rate for some objects. FlxTimer comes quite close to them, but has some limitations as I see. Thanks!
Reply all
Reply to author
Forward
0 new messages