Jump to content

Tween issue, short time, large distance, many repeats


Djloop
 Share

Recommended Posts

Hi,

Im having an issue with tweens. Its a bit difficult to explain, so please bare with me..

this.tween = this.game.add.tween(this.itemToTween).to({
      y: y+100
    }, 100);

It is a quick tween over a relatively large distance that is repeated many times. If the itemToTween is moved by say 15 pixels per frame (for example), the last frame is moved only 10 pixels to exactly end at position y+100. 

This 10 pixel move in the last frame as apposed to the normal 15 pixels per frame is causing hiccups/staggering on the tween repeat and other running tweens on other items are becoming out of sync position wise. 

 

The only solution I could think of was maybe doubling the distance and time of the tween and then manually checking on the tween update if the position is greater than y+100. In that case stop the tween and trigger the new tween and subtract the distance the original tween shot over y+100. This seems like such a hack though...

Does anyone have a suggestion on a cleaner solution? Thanks.

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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