destroys only one actor?
Hey everyone
I got a problem in my game
I want when a button touch is press, delete one enemy(there is a bunch of them)
so what I do is
make an attribute press? boolean, false
when touch is press change it to true
in the enemy actor, when press? is true destroys this actor
but then it will destroy all of them, any ideas?
P.S. I aslo want when touch is press, destroy half of the enemy(ex: if there is 20 enemies then destroy 10, if 33 then destroy 17 etc)
thanks for the help
Calvin
_________________________________________________
http://www.gamesaladforum.com/
http://gshelper.com/
http://www.youtube.com/user/GameSaladCookbook#p/
I got a problem in my game
I want when a button touch is press, delete one enemy(there is a bunch of them)
so what I do is
make an attribute press? boolean, false
when touch is press change it to true
in the enemy actor, when press? is true destroys this actor
but then it will destroy all of them, any ideas?
P.S. I aslo want when touch is press, destroy half of the enemy(ex: if there is 20 enemies then destroy 10, if 33 then destroy 17 etc)
thanks for the help
Calvin
_________________________________________________
http://www.gamesaladforum.com/
http://gshelper.com/
http://www.youtube.com/user/GameSaladCookbook#p/
Comments
and thanks soooooo much for the reply T
also, when touch is press change it to true, but I won't touch the enemy
@tshirt
it will destroy all of them
________________________________________________________
http://www.gamesaladforum.com/
http://gshelper.com/
http://www.youtube.com/user/GameSaladCookbook#p/
http://gamesalad.com/forums/topic.php?id=25293
use the first part of this to give each enemy a unique ID. Then you could have this in the enemy:
when game.touchNumber (integer) = self.actorID
-----destroy
then in the button have a rule:
when touch pressed
change game.touchnumber to game.touchnumber + 1
when I have 5 enemies at first, I touch the button 3 times, now there is 2 left
after spawning 3 more, I touch the button again, it destroys two of them
then put a display text with the game.touchnumber in the button
maybe that will help you figure out what is wrong
because I can destroy the enemies in other ways, for example there is 5 enemies on the scene
I destroy 2 and 4(ID)
now when I touch the button, 1 destroys , but when I touch it again, 2 won't destroy(because it is gone already)
______________________________________________
http://www.gamesaladforum.com/
http://gshelper.com/
http://www.youtube.com/user/GameSaladCookbook#p/
how about something like this
when button touch is press, change image enemy to enemy two(on of them)
destroy that