Wednesday, July 18, 2012

Lasers And Player Collision

Previously, I described how lasers collide with the environment in Bullet Time Ninja. Today, let's talk about how to detect collisions between lasers and the player.

The trick I used was to treat the player as a circle, and do a line-circle collision test.

I chose a circle since it fills out most of the ninja, while also leaving a bit of wiggle room to make the gameplay more forgiving. Alternatively, I could have done laser-box collision, but that one is a little more complicated.

Not to say that the circle one isn't.