how to swap actor-1 position with actor-2 position ?

arabianwolfarabianwolf Member, PRO Posts: 79
edited October 2012 in Working with GS (Mac)
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 ?

Best Answer

  • tatiangtatiang Posts: 11,949
    Accepted Answer
    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

  • arabianwolfarabianwolf Member, PRO Posts: 79
    up
  • ElfizmElfizm Member Posts: 489
    Hello @arabianwolf

    I sent you PM about this ages ago that had the answer your looking for. Did you get it.

    Good job @tatiang :) I just made a demo because I didn't know if I could explain it so it was understandable. So you have a great skill :)

    Elfizm
  • arabianwolfarabianwolf Member, PRO Posts: 79
    thank you all , i did it but thank you for comment
Sign In or Register to comment.