PDA

View Full Version : Collision in Create()



nzo2
24-01-2005, 01:29 AM
How can I check in my SpriteClass.Create if I am intersecting (colliding) immediately with another sprite? I tried collisioned, but doesn't seem to work (properly) - that is, it appeared to work, but not 100%.
What I want to do is reset the X,Y of the sprite, if it already intersects an existing sprite (of another class).

Traveler
24-01-2005, 09:30 AM
I remember struggling with this as well. I don't think I ever found a solution though.

However, it might be possible to create a 'spritelist' upon starting the game, where all sprites are initially set to 'dead' or 'inactive'. Then, when you need a new sprite, you can activate it by looking in the list for a non-active sprite, and set it to the correct x and y coordinates, and in your case, check for collision.
When you don't need the object anymore simply set the sprite to inactive again.

Hope this helps.

nzo2
25-01-2005, 12:17 AM
Yea, that makes sense. I might have to resort to that, but at the moment it isn't causing me massive problems.