How could I replace an actor with another one on button command
FlyboyTrevy_
Member, PRO Posts: 148
So I have it set up that when a button is placed it sets a rule to true. Then in the corresponding actor, I want to have it so that when that rule is set to true, it replaces that actor with a green version of it with different collision properties. So I have on the actor, when the rule is set to true, now what would I put in the Do box to make this happen?
Comments
Your rule needs to change a boolean attribute (e.g. game.Change or whatever you want to call it) to true. Then in the other actor, have a rule that says If attribute game.Change = true then ... change to a different color/image.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
first start by setting your changing actor to keep track of a game level boolean attribute like tatiang says but then you have a couple of options.
1) you can make the actor spawn an entirely different actor with the different set of colors/collision rules, then destroy the original actor or
2) nest each set of color and collision rules in the original actor's do/otherwise sections of the rule that tracks the value of the game level attribute:
if thingImTracking = true
color = A
collision = A
otherwise
color =B
collision = B
Corresponding actor:
. . . . . . . . . . .
When rule is true:
Change attribute - self.colour.red to 0
Change attribute - self.colour.green to 1
Change attribute - self.colour.blue to 0
Collide with X
Otherwise:
Change attribute - self.colour.red to 1
Change attribute - self.colour.green to 1
Change attribute - self.colour.blue to 1
Collide with Y