integers or booleans?
GamersRejoice
Member Posts: 817
Are booleans or integers faster?
Im having an actor spawn at the top of the screen and when that actor falls and collides with another actor in the center it subtracts from a hud up at the top set to five. I'm currently setting a boolean to true when the top actor collides with the bottom actor. However the number isn't always subtracted from my hud, it does it when I spawn the actors really slowly, but once I spawn a bunch of them quickly it only subtracts the points every few actors rather than every single one. Would it work better if I used an integer instead of a boolean? Any pointers as to how to make this work flawlessly?
Edit: Actually I've noticed it only seems to work when I spawn one actor at a time. Once that one is collided and destroyed it subtracts points and then I can do another. But when I spawn five right in a row for example, it will still only subtract 1?
Im having an actor spawn at the top of the screen and when that actor falls and collides with another actor in the center it subtracts from a hud up at the top set to five. I'm currently setting a boolean to true when the top actor collides with the bottom actor. However the number isn't always subtracted from my hud, it does it when I spawn the actors really slowly, but once I spawn a bunch of them quickly it only subtracts the points every few actors rather than every single one. Would it work better if I used an integer instead of a boolean? Any pointers as to how to make this work flawlessly?
Edit: Actually I've noticed it only seems to work when I spawn one actor at a time. Once that one is collided and destroyed it subtracts points and then I can do another. But when I spawn five right in a row for example, it will still only subtract 1?
Comments
So you may want to have a self.boolean in each called self.Destroy.
Then
Rule - When collides with _____
change score to score-1
change self.destroy to 1
Rule when self.destroy is true
destroy actor
-----
Or try the same thing but put a timer around the destroy
and put your collides in a "when destroy is false" along with a change self.alpha to 0