Change Attributes Not Tracking

Ok, I am probably over complicating this. I am working on a "keep the ball in the air" game to learn my way around GS. When touch is pressed a small actor is spawned under the finger location and is the agent to collide with the ball. Part of the game play involves spawning additional balls after multiple taps and multiplying the scoring for consecutive taps without popping a ball.

To achieve this I am tracking taps on each ball: when the actor collides, change attribute self.tap to self.tap+1 and add to score

And tracking the number of balls for score multiplying: when self.tap>=5, spawn ball, change game.balls to game.balls+1, and reset self.tap to 0.

This is all working, about half the time. Sometimes there is no spawn but the number of balls increases. Sometimes the score doesn't move.

Is there a consistent issue with this kind of tracking or a better way to address?

Thanks for any input

Comments

  • MohboDesignsMohboDesigns Member Posts: 13

    Forgot to add that the destroy ball function also coincides with a change game.balls to game.balls-1. Sometimes all the balls will be gone, but the game still shows a number of balls present since they didn't all spawn correctly.

  • rdlew2008rdlew2008 Member, PRO Posts: 85

    Gamesalad isn't perfect and sometimes you have to try different things to get them to work

    Also sometimes if your logic doesn't all match up it will make the game bug out. I myself would think....are you using touch or release. When you are spawning the actor is it trying to sometimes spawn on top of the ball rather than just before.

    Are you trying to make everything happen at once? Sometimes I use a timer to separate large chunks of commands...could be just .01 of a second.

  • MohboDesignsMohboDesigns Member Posts: 13
    edited April 2014

    I'm using touch to spawn a "kicker" actor that constrains velocity toward the touch position. All this works fine. The spawn is set to be at the same position as the actor.

    @rdlew2008 said:
    Are you trying to make everything happen at once? Sometimes I use a timer to separate large chunks of commands...could be just .01 of a second.

    >

    I think this could be the issue. Once GS misses a change attribute it goes downhill. I will try separating them. Thanks!

Sign In or Register to comment.