Collision detection in a top down game

6 posts

Flag Post

Hi.
Im working on a top down game, and I’m kinda lost on the collision detection.

Basically i want a character to stop moving when he hits another character. This wouldn’t be any problem in a tilebased game, but i haven’t really done any collision detection on complex shapes before.
Another thing is, the character shouldn’t be able to rotate through other characters or objects either.

Are there any engines that you can recommend, or can you point me to an article from where i can learn about this?

in advance: Thanks :)

 
Flag Post

In case it helps, you can see a demo of a character here:
http://www.danishdragon.com/MyGame.html
(I’m working together with Craksy)

 
Flag Post

Is it necessary that they actually touch? Those characters would fit very nicely inside a rectangle.

 
Flag Post

I wouldn’t mind it just doing the collision detection based on rectangles – but still need to figure out how we want it to react when rotating into another player or object.

 
Flag Post

The rectangle doesn’t need to rotate. When the character rotates, calculate the new rectangle.

 
Flag Post

Wouldn’t it be easier to have five centre points and radii for five circles (head, right shoulder, left shoulder, right hand, left hand) and check based on those? You’d need to keep track of rotational positions yourself then, of course, rather than just altering the rotation var of the Sprite/MovieClip, so maybe “easier” isn’t the proper word to use… But then you’d have very accurate collision testing (for the character you show), including the moving hands, and you could do localized detection (knowing which part of the body collided; for damage, allowing the body to still move if only the hand collided, etc).

Edit (excised localToGlobal stuff that isn’t useful in this case)