how to swap actor-1 position with actor-2 position ?
hi
iam working with a game , that need to touch on actor-1 , then you touch actor-2 and the behavior done by swaping the position between the two actors.
i search for the behavior but i didnt find it in game salad ?
iam working with a game , that need to touch on actor-1 , then you touch actor-2 and the behavior done by swaping the position between the two actors.
i search for the behavior but i didnt find it in game salad ?
Best Answer
-
tatiang Posts: 11,949
Your answer lies in the Tower of Hanoi.
If you've never tried that puzzle, well, here's what you need to do:
Unlock actor 1 and actor 2 so you can access their attributes from each actor.
Actor 1: When touch is pressed --> change attribute self.OldX to self.position.X, change attribute self.OldY to self.position.Y, change attribute game.touchCount to game.touchCount+1. When attribute game.touchCount=2 --> change attribute self.position.X to Actor2.position.OldX, change attribute self.position.Y to Actor2.position.OldY.
Actor 2 would have similar rules.New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Answers
I sent you PM about this ages ago that had the answer your looking for. Did you get it.
Good job @tatiang
Elfizm