Actor Tally help

okay it's a very simple concept but I'm having a bit of trouble getting it to work correctly. If any of you have any insights or things to try then I'm. happy to try and give it a whirl. I'm all ears!

In short I have an spawning actor that spawns a wave of actors every level. The levels aren't new scene's just a number on a table that increases after every wave. The idea is to kill these actors in each wave by touching the screen and triggering a chain reaction of collisions. Now this part is fine. the spawner works exactly as it needs to, as do these collisions as does the level counter.

I have set up a game attribute called "actor tally" and what I need it to do is count how many actors are on the screen at any one time. When an actor is spawned I have used the logic

change attribute "actor tally" to "actor tally" +1

and when it collides with another actor and is destroyed I have used ,

change attribute "actor tally" to "actor tally -1". then "destroy this actor".

The problem is after a few waves, errors seem to creep in. It says there are things like -2 actors when there are 4 bouncing around!?!?!

I have triple checked everything through and all is how it should be on prototypes, but it keeps happening.

I don't want to destroy the actors that aren't killed in each wave and generate new ones as it means you can tactically choose not to to kill certain actors (if you have the skill) as they may help you on the next level. Or the opposite could be true and you could make the next level even harder for yourself (if you don't have the skill). So it has to be a continuous running tally as this becomes integral to the gameplay as the game develops.

Also if you destroy all the actors in one particular wave, you're rewarded bonus points, but with these errors it means that this doesn't work as you can get the be awarded these bonus points when not all of the actors are destroyed or the complete opposite.

It's like some collisions are registering too many times and others not all?

I thought just a +1 and -1 would suffice, and in my head the logic stands to reason but I'm beginning to lose my head with it. What am I doing wrong?

PLEASE HELP!!!! :)

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited June 2014

    "I have triple checked everything through and all is how it should be on prototypes, but it keeps happening"

    If you've triple checked through all your code and still can't spot the error, what chance has anyone else of spotting the error when they can't see the code ? :)

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    Yeah, it sounds like your logic is correct. So there must be a hidden error somewhere you are not finding. To help check for errors maybe add an actor to your scene so you can monitor the value of 'actor tally' and see exactly its value during the game and when it increases and decreases.

  • aaronforsteraaronforster Member Posts: 28

    Yeah that's how I've been monitoring it and I can see that this is happening but I'll go through again, hopefully there is a simple error somewhere I've overlooked.

Sign In or Register to comment.