making one actor disappear and reappear by touching a 2nd actor.

Hey everyone, I just found out how to make one actor be destroy by touching on another actor now I trying to being that actor back.
This is what Im looking for .
actor A is on the left side and actor B is on the right side. I touch actor A and that will make actor B disappear then I touch on actor A again and actor B comes back in the same spot on the right side. How do I do this?
This is what Im looking for .
actor A is on the left side and actor B is on the right side. I touch actor A and that will make actor B disappear then I touch on actor A again and actor B comes back in the same spot on the right side. How do I do this?
Best Answers
-
JohnPapiomitis Posts: 6,256
make a game attribute called toggleObject or whatever you want to call it.
In actor A have when touch is pressed:
- change attribute toggleObject to (toggleObject+1)%2
In actor B have a rule when attribute toggleObject =1
- change attribute self color alpha to 0
Then in the otherwise section of that rule have a change attribute and change self color alpha to 1 -
Nmdogdude Posts: 174
create an invisible actor under actor B
under actor A's behaviors create a rule 'when touch is pressed, spawn actor B'
Answers
on my computer it say "if toggleObject is true" i know this is messing up the code
Thanks it works!