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

Pixel collision

Sign in to follow this  


After I put up the video, Jesse Chounard mentioned how I didn't appear to be using pixel collision in the game. This is true, up till now I've simply been using bounding box collision, which won't really cut it for a game like this. So, I've started getting pixel-perfect collision working.

So far it is working smoothly, and I have the player's bullets working with pixel-perfect collision. Now I just need to do the same with ship collisions and enemy bullets. The hardest part will be getting this to work with Rotating objects, such as the saucer enemies and the asteroids I'll have later on.

On an unrelated topic, my offical review of Dynasty Warriors Gundam:
Sign in to follow this  


Recommended Comments

Turns out that's really easy, if you're using code from the sample I pointed you to. I got it working with arbitrary translations, rotations, scaling, and animation. And there's little impact on frame rate as long as you check for bounding box collision before going pixel perfect. (You don't want to be copying the pixel data around every time you update animation frames.)

Share this comment

Link to comment
I implemented it on the bullets in the same way as the tutorial, and I haven't noticed any slowdown. I was suprised at how easy it was to implement, I got the whole thing working fairly quickly.

One thing I'm doing now is having my Sprite objects create the color array upon loading so every sprite has that data for collision detection.

Share this comment

Link to comment
If the sprites don't have any animation, that's a great way to do it. The memory required blows up pretty quickly if you have lots of different animations, though.

Since we're only looking at the alpha values, with a little precomputing, the data could be compressed down to a series of boolean values, and then stored as packed bits or run length encoded. But that's a little more work than I wanted to bother with, since I already had it working at a reasonable speed.

I'm looking forward to playing your. Are you planning to add anything neat for playing with the 360 gamepad? Special abilities on the right thumb stick, maybe?

Share this comment

Link to comment
It shouldn't be a problem for this game, as there isn't alot of animation. I would probably have to find another way if I were doing a platformer or something like that, though.

Currently, the game can be played using the 360 gamepad, although I haven't added any special abilities for it. I'll also be porting it to the 360 when I'm done, and have that version available for Creator's Club members.

Share this comment

Link to comment

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!