jung34 Posted October 3, 2015 Share Posted October 3, 2015 Hi, I'm trying to sync audio to the start of a tween. this.myTween = this.add.tween(...)this.myTween.onStart.add(this.playSound, this) Instead, the audio plays first and then a few moments later the tween starts. I read the onStart should wait until the tween starts, but this doesn't seem to be happening. Please help! Link to comment Share on other sites More sharing options...
jmp909 Posted October 3, 2015 Share Posted October 3, 2015 is there a delay on your tween? what's the actual code? Link to comment Share on other sites More sharing options...
jung34 Posted October 3, 2015 Author Share Posted October 3, 2015 Hi, the tween moves the sprite. The sound needs to play at the start of this movement. I'm not sure how to set the delay to zero. tween1: function() { this.tweenMini1 = this.add.tween(this.spriteMini).to({ y: this.world.centerY}, 2000, Phaser.Easing.Back.In, true, 0); this.tweenMini1.onStart.add(this.playSwoosh, this);}, playSwoosh: function() { this.swoosh.play(); this.swoosh.volume = 0.3;}, Link to comment Share on other sites More sharing options...
jmp909 Posted October 3, 2015 Share Posted October 3, 2015 your delay is 0 already I believe it's your easing.. look here:http://easings.net/#easeInBack see how it goes down and then up... (i've marked it in green).. I think you're not seeing it until the up part of the graph there. if it's an opacity alpha then of course you're not going to see any negative alpha... so yes it's going to look delayed[edit: sorry you're tweening Y.. i'm not sure about that then.. it depends where your sprite is starting. you should see it moving if it's on screen) I'm don't know what easings Phaser includes but use this to compare with what you needhttp://easings.net/ Link to comment Share on other sites More sharing options...
jung34 Posted October 3, 2015 Author Share Posted October 3, 2015 Thank you jmp909, it was the easing. The sprite was off screen to start, so I didn't see the movement. I've changed the easing to Back Out and it works fine now jmp909 1 Link to comment Share on other sites More sharing options...
Recommended Posts