I have a player sprite and 10 home sprite instances. Each home sprite has variable called location, and each has their own number (Home.location=2, Home.location=3, etc.).
Whenever I click a home sprite, I want the player sprite to move to a certain home sprite. So if I click on any home sprite, I want the player sprite to move to the home sprite with instance variable of 6.
On tap gesture on Home = Player move to Home.X(with the instance variable of 6), Home.Y(with the instance variable of 6)
How do I code this in the X and Y co-ordinates??
I tried tried this
On tap gesture on Home = Player move to Home(Home.Location=6).X, Home(Home.Location=6).Y
but the player keeps moving to the home sprite with the instance variable of 0.
Any help is appreciated, Thanks!