Counter Problem

dimps620dimps620 Member Posts: 49
edited April 2012 in Working with GS (Mac)
Has anyone had any problems with simple counters. I have noticed some strange things with mine. I'm basically spawing 15 actors on the screen. If that actor is spawned on top of another actor it is destroyed and tries again till it reaches 15. My problem is that my counter is going negative some times. It will eventually hit 15 but don't know why it would be have a value of -5. In my actual program it spawns a new actor and has the possibility to collide or overlap with about 10 different actors. In each case the number of actors counter goes +1 and than -1 if it was spanwned on top of another actor. Does this seam logical to you are is there some kind of timing thing going on.

I tend to display a lot of attributes(counters) on the screen so I can watch them and make sure it is doing what it is suppose to do.

if #ofactors is <15
spawn actor 1
#ofactors = #actors + 1

if actor 1 collidesor everlaps with actor 2
destroy actor 1
#ofactors = #actors -1

Answers

  • dimps620dimps620 Member Posts: 49
    I was able to figure this out. It had something to do with overlapping with actors that I was tested against. My counters are now showing me what I want.
Sign In or Register to comment.