Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Work Is Never Done

Sign in to follow this  


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
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!