Game Development Community

keeping score with collisions

by rennie moffat · in Torque Game Builder · 02/10/2010 (4:15 pm) · 2 replies

Hi, I am using a variation of the astroids scoring behaviors,
however, I want to trigger a score of x value on collision, the problem is, that my collision lasts longer than an instant SO the compiler adds a score, adds a score, adds a score until the collision is over.

Currently the collision takes place between a stationary object and a falling object. I am obviously going to have to put my mind to this some more but if anyone has any ideas of how to make a score count only for the instant a collision happens. I have tried safeDelete, but that is not good as I need the object that would be deleted, I have tried setPosition() but it did not work. I need to somehow only allow the falling object and the stationary object to register one instant of a touch.





About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.


#1
02/10/2010 (5:30 pm)
I'm not too sure how TGB works but in torque X I would put a bool in the component I added to my enemy objects that would be set to false off the bat and when a collision happens I would check the bool and if it was false I would add the score and set the bool to true then when another collision happens it would be true and not add the score.

now if you need the objects stay alive in the game after the collisions happen then you would have to find a way to reset the bool after a certain ammount of time or something similar
#2
02/10/2010 (6:43 pm)
hmm interesting thanks Scott, will think about that.