jpdev Posted May 18, 2014 Share Posted May 18, 2014 Hi everyone, I think I ran into a bug in phaser 2.0.4 when using chained tweens. I chain tweens by adding them onto the same tween object by repeatedly calling the "to" method. This works great, BUT if the game loses focus, then the chained tweens are just forgotten about by phaser. EDIT: powerfear figured out what was wrong with my code, I had autostart = true for all chained tweens.This (weirdly) resulted in the tweens working perfectly only as long as there was no tab change at any time.(But if the tab was changed the tween chain broke.) I lef the broken example up: Example: http://jppresents.net/static/examples/boardgame/bug.html Sourcecode: http://jppresents.net/static/examples/boardgame/gameBug.js Could anyone check if I am doing something wrong?If not I will open a github issue for this. Happens in Firefox, Chrome and IE. Link to comment Share on other sites More sharing options...
powerfear Posted May 18, 2014 Share Posted May 18, 2014 I'm not sure why the game losing focus cause this but try only starting the first tween. So instead of having true on autoStart for every .to call just call start at the end.function movePlayer(position) { var tween = game.add.tween(player.image); for (var i = player.position; i < position; i++) { tween.to({x: positions[i].x, y: positions[i].y}, 500); } tween.start();} jpdev 1 Link to comment Share on other sites More sharing options...
jpdev Posted May 18, 2014 Author Share Posted May 18, 2014 Thanks for pointing that out.Without the autostart all works fine. So I guess not really a bug, but still strange behavior. (Won't make a github issue though.) Link to comment Share on other sites More sharing options...
Recommended Posts