Jump to content

Bug: Phaser dropping chained tweens


Recommended Posts

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:











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

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();}
Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...