How To Only Have One Actor By Deleting the Old Actor After Another One Placed?
I would like to be able to place an actor "Player 1" with touch (I already know how to do that.) and then when I place another "Player 1" actor, the last actor will be deleted. I want to do this so I can only be allowed to place one. Any suggestions?
Best Answer
-
ericzingeler Posts: 334
I would suggest that you identify your spawned actors so that they are unique. Once that is done, a simple rule is all it takes. Like so:
Game Attribute:
activeID (index) = 0
Spawned Actor Attribute:
myID (index) = 0
Inside spawned actor:
Very first behavior outside of any rules:
Change attribute game.activeID To: game.activeID + 1
Change attribute self.myID To: game.activeID
A rule to destroy actor (placed after the above):
If self.myID not equal To: game.activeID
destroy
Answers