Work Is Never Done

Published July 26, 2009
Advertisement
Finally got pixel perfect collision working today [smile]! After a couple of days of trying this and that it now finally works!

The way I do it is that when there is an overlap along one of the four edges (for some reason I was also checking corners probably because I should have done it for Breakout where there would be a different action but here it doesn't matter). Then I go through the corrseponding edge of the bullet image and find the first non-transparent pixel. I then convert from bullet image coordinates to screen image coordinates and then to ship image coordinates. Then I check this pixel on the screen image to see if it's non-transparent as well and if it is. Collision!

I also solved a bug, which I hadn't noticed before where the enemies wouldn't exit the RELOADING state (added so that the enemy doesn't fire all its bullets at once producind one really long one) which was due to a mathematical error.

Next, I will give the player and enemies health (so that it isn't one-shot kill) and a health bar for the player. Or I will try to get enemies charging at the player in order to capture him (this will result in instant game over I think) so that I have a complete enemy and then I can generate the different types. Or I will add scoring and high scores. What a choice! [grin]

Thanks for reading
-AEdmonds
Previous Entry Someone Watching Over Me
Next Entry Still Take You Home
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement