Jump to content

Stumped. Can't get a chain of tweens to repeat


GreatBigBore
 Share

Recommended Posts

I thought it would be obvious how to make this work, but it's not working. It goes one time, and then stops forever. I've re-read the doc on chaining and repeating ten times, and I've tried to follow through the tween code in the Phaser lib. I must be missing something obvious from looking at it too much. What am I doing wrong?


  this.midnightToSunup = game.add.tween(this.sunChariot).to(
    { x: - 100 }, 5000/*this.dayLength*/, Phaser.Easing.Sinusoidal.In
  );

  this.sunupToNoon = game.add.tween(this.sunChariot).to(
    { x: game.width / 2 }, 5000/*this.dayLength*/, Phaser.Easing.Sinusoidal.In, false
  );

  this.noonToSundown = game.add.tween(this.sunChariot).to(
    { x: game.width + 100 }, 5000/*this.dayLength*/, Phaser.Easing.Sinusoidal.In
  );

  this.sundownToMidnight = game.add.tween(this.sunChariot).to(
    { x: game.width / 2 }, 5000/*this.dayLength*/, Phaser.Easing.Sinusoidal.In
  );

  this.sunupToNoon.chain(this.noonToSundown, this.sundownToMidnight, this.midnightToSunup);
  this.sunupToNoon.repeat(-1);
  this.sunupToNoon.start();

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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