Skip to main content
GameDev.net gamedev.net
🔒 Locked

Collision Problem

Started by Edison Bright Jan 18, 2003 at 8:30 PM 1 replies 350+ views
Original Post
Edison Bright
Edison Bright
I wanted to test if a 4x4 bullet sprite collides with a 32x24 enemysprite so I write the following code:
collided = true;
				
				if (bullets.y+4 < enemies[j].y) collided = false;
				if (bullets[i].y > enemies[j].y + 24) collided = false;
				if (bullets[i].x+4 < enemies[j].x) collided = false;
				if (bullets[i].x > enemies[j].x + 32) collided = false;

				if (collided == true)
				{
					enemylist[j] = 0;
					bulletlist[i] = 0;
				}
 
This does not seem to work very well (only about 10% of the time) ... I wonder why?
Peace!- Edison Bright
Edison Bright
Edison Bright
Shit ... Its all my fault ... I messed up another part of the code.

Mods please remove!!!
Peace!- Edison Bright

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.