Tween implementation in separate script


#1

Hi, I’ve forked Flappy Bird from @will. I forked an old version of this game (before he updated the game to use 2D sprites), and I’m trying to copy the tweened score from the scoreboard. It adds +1 score per 500ms until it gets to the score you have achieved previously in the playing stage.

However, in my game, (3D) I cannot seem to do this even if I copy his script (scoreboard.js) He uses the tween code:

     var tween = new TWEEN.Tween(this.score)
            .to({ current: current }, 500 )
            .onUpdate(function (obj) {
                var score = Math.round(obj.current);
                app.fire('ui:current', score);
                if (score > best) {
                    app.fire('ui:best', score);
                }
            })

If I use this code, however, this does not work? Any help is appreciated, thanks :grinning: