Simple game
I am new to AI and I would like to know how to test for a collision between a robot and a missile. The game is pretty basic, just a character moving along the bottom of the screen with missiles being dropped on him from an enemy moving along the top of the screen.
The x value is the only co-ordinate of the character that changes, the y stays the same. The x value and y value of the missile changes.
I don't want any code, just a general idea of the best way to do it.
Check if the missles x coordinate is somewhere within the X and X + width of your character.
i.e.
character Width = 8
if missle y >= some number where it could possible hit the charater
AND
missle x is >= character x and missle x is <= to (character x + character width)
then
you have a colision.
i.e.
character Width = 8
if missle y >= some number where it could possible hit the charater
AND
missle x is >= character x and missle x is <= to (character x + character width)
then
you have a colision.
------------------http://www.nentari.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement