Sign in to follow this  
NicholasGustav

restart map point

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();

        } 
}
    

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.