Changing actor problem

I have 2 different color actor, red and blue. I put red actor on center. When i touch blue button, it change from red to blue actor. But it remains red actor behaviour. Anyone can help? Thanks.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    How are you "changing" the actors? Are you spawning one of the two actors? Are you destroying one of the two actors?

    Are the two button actors overlapping in the scene?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • wolala123wolala123 Member Posts: 248

    @tatiang they no overlap ...i am using change image, is it valid?

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited April 2016

    Either spawn a blue actor and destroy the red actor then the blue actor will have the blue behaviours or do what you're doing by changing the image on the one actor but have an attribute on the actor to flag whether it's currently red or blue, and then have two rules with your behaviours in i.e.:

    If self.colourName is "blue"
    ... add blue behaviours

    If self.colourName is "red"
    ... add red behaviours

    In this example I'm using a text attribute called colourName. You would change the attribute at the same time you change the image. You could use numbers i.e. 1 for blue and 2 for red. Whatever you prefer and can easily understand when you look at the code again in a months time.

Sign In or Register to comment.