Hey! So yesterday I was looking to update my phaser.min.js for a more recent one, unfortunately some of my menu code broke (this being the only tween in there). I was wondering if there’s a new way to retrigger any tween that has been played once? (the phaser.min.js version is v3.90.0 “Tsugumi”)
This is the code that used to work before I replaced the phaser.min.js
create (){
this.hopOnAnim = this.add.image(750, -270, 'hopon_dev');
this.hopOnUp = this.tweens.add({
targets: this.hopOnAnim,
y: '+=570',
ease: 'Power2',
paused: true
});
this.hopOnOut = this.tweens.add({
targets: this.hopOnAnim,
y: '-=570',
ease: 'Power2',
paused: true
});
};
update{
//this is for the tween to play
if(this.hopOnExecute){
this.hopOnUp.play()//the sprite enters from the top
this.hopOnExecute = false
this.time.delayedCall(2500, () =>{ //the sprite goes away to the top
this.hopOnOut.play()
this.invalidPlayed = false //unlocks the sound
this.buttonLock = false //unlocks the keys
})
}
if(this.keyEnter.isDown && !this.hopOnExecute && !this.buttonLock){
this.hopOnExecute = true
this.buttonLock = true //locks all inputs
if(!this.invalidPlayed){ //gives a message and plays a sound
console.warn("The developer has a nap. Hold out! developer!\n This will be available in the future")
this.invalidPlayed = true //this is for the sound to play once
this.sound.play('invalid')
}
}
}