Thursday 19 April 2012

Sprite Scaling and Collision Detection

Spent some time tweaking sprite sizes in game. The destroyer (and bomber) units are now larger and more threatening. The knock on effect of this, is that I'll need to drop the pixel perfect collision detection. This is a piece of code I wrote probably 15-20 years ago. It has served me well but doesn't work with free rotation and scaling. It's hard to let go of code that took some time to figure out, but sometimes a mercy killing is required.

You can see the difference here:



Collision detection is now based on overlapping circles. This fits well with the ship shapes and the shields. The system may need to be more flexible for future games but serves well for now.

The use of scaling also means that I can optimise texture memory.

I spent a fair chunk of time this week planning an extension to our house. Now that the house is full of toys and a small boy running around, we definitely need more space!

No comments: