Jump to content

restart map point


NicholasGustav
 Share

Recommended Posts

 

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...