Search the Community
Showing results for tags 'onStart'.
-
I've created some buttons for the main menu of my game and I wanted to add a nice animation of the buttons moving off screen with a short delay after each other. So I made a bunch of buttons and gave each of them their own tween and then combined the tweening process like this: tempTweens[0].onStart.add(function () { console.log('onStart fired'); game.time.events.add(tweenDelay, function () { tempTweens[1].start(); }, this); game.time.events.add(tweenDelay * 2, function () { tempTweens[2].start(); }, this); game.time.events.add(tweenDelay * 3, function () { tempTweens[3].start(); }, this); }, this);But when I do tempTweens[0].start(); it does what I want it to.... 1 time. The second time I do tempTweens[0].start(); it only moves the first button and not the other ones. I even made a small loop after this code to check. for (var i = 0; i < 10; i++) { tempTweens[0].start(); }and it only writes 'onStart fired' to console 1 time. I'm thinking I haven't fully understood how .onStart works but my guess was that stuff like this should only happen if I had used .addOnce not .add.
-
I'm using a tween that changes the texture of a Sprite when onComplete method gets called. Sometimes it fails to change the texture via this.sprite.loadTexture('myTexture'); . Everything works fine with Phaser 2.3 .
- 12 replies
-
- loadTexture
- tween
-
(and 2 more)
Tagged with: