Sign in to follow this  
  • entries
    55
  • comments
    55
  • views
    24447

Work Is Never Done

Sign in to follow this  

129 views

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


0 Comments


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