Killing an Actor after 5 on screen?
TouchTiltGames
Member Posts: 1,162
Ok I've got a gun and it's shooting bullets on the screen, but I want to kill the first bullet shot of the 5 so there's only ever 5 on screen.
So with my limited knowledge, but trying to grasp this: I've setup a Rule and attribute..but then do I setup an interger? I was trying an Attribute like: game.BallCount > 5 then Destroy..but that doesn't seem to work
Thanks in advance!
So with my limited knowledge, but trying to grasp this: I've setup a Rule and attribute..but then do I setup an interger? I was trying an Attribute like: game.BallCount > 5 then Destroy..but that doesn't seem to work
Thanks in advance!
Comments
but if you know, that you spawn 1 bullet every second. why not put a timer inside the bullet, that says "after 6 seconds - destroy"
this way, you would only have 5 bullets on the screen each time.
what you could do to not shoot more than 5 bullets at a time would be create a attribute "bullet_num" and give each bullet a change attribute that adds +1 the the "bullet_num"
then on the spawner of the bullets make a rule, if "bullet_num" is < than 5 spawn bullet
this way when you have 5 bullets spawned it would not spawn any more until a bullet is destroyed (which you would then do another change attribute to "bullet_num" -1)
now i have to think a little on how to make the first one get destroyed automatically.
The last RULE you need in the bullet is one that checks for when the self.integer exceeds 5; when that happens, destroy.