NicholasGustav Posted December 6, 2017 Share Posted December 6, 2017 Hello! I'm trying to get an object to have two path options, one correct and the other incorrect, and when it arrives at the given place, the keys are reset and I can do the same, but with other points on the map. The best result I achieve is using if, and with tween, but the problem is that I do not know how to reset the addresses of the keys when I arrive at the place. any ideas? Quote function update() { let { up, down, left, right } = this.cursors; if (up.isDown) { tween = game.add.tween(sprite).to( {x: [500], y: [200] }, 2000); tween.start(); tween.onComplete.removeAll(); } if (left.isDown) { tween = game.add.tween(sprite).to ({ x: [100], y: [500]}, 2000); tween.start(); tween.onComplete.removeAll(); } } Link to comment Share on other sites More sharing options...
Recommended Posts