integers or booleans?

GamersRejoiceGamersRejoice Member Posts: 817
edited November -1 in Working with GS (Mac)
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?

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I'm not sure that is the problem. It may be that GS is moving fast enough that it went right over that rule without executing it.

    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
  • GamersRejoiceGamersRejoice Member Posts: 817
    Thanks scitunes, that helped me figure it out. My problem was that because I'm spawning the same actor I have to change my attributes back to false right before it destroys itself. Woo Hoo!
Sign In or Register to comment.