Advertisement

space invaders

Started by March 02, 2000 01:13 AM
5 comments, last by nlecren 24 years, 8 months ago
hello i am attempting to make my first game using direct x although i am not having many problem with the basics of it i would just like to know if anyone has any tips on how to do collision detection on a space invaders type game. Just a simple algorithm would do im just trying to learn the basics with this so im not worried about accurate hits. thanks
A basic algorithm is just do a bounding box test against objects that matter. If I remember space invaders right, then just the ship against shots and enemies and the ship''s shots against enemies.
Advertisement
I think the original Space Invaders actually used color keys for checking if a hit was scored (since the background was all black). However, I would recommend bounding boxes (this leads to an interesting question on how to handle the shields, but that''s half the fun of game programming :
)

-Chris

---<<>>---
Chris Rouillard
Software Engineer
crouilla@hotmail.com
---<<>>--- Chris Rouillard Software Engineercrouilla@hotmail.com
If you go to my site (http://www.crosswinds.net/~uselessknowledge) you can download my source code for a space invaders game, which uses the bounding boxes method for collision detection.

------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge
You might do something along the lines of:

if (missilex < alienright //
missilex > alienleft //
missiley < alienbottom //
missiley > alientop) {

DO STUFF FOR GETTING HIT

}

Hope that helps.

- Daniel
http://sw.mtx.net/daniel/
- DanielMy homepage
thanks to everyone for the replies I appreciate it Qoy i took a look at your game it''s pretty cool. Just one question though how long did it take you?
Advertisement
Well, I used the engine with the book, and I worked on it for a while every day last summer. It took me about the whole summer, so about three months give or take a week or two.
Thanks for looking at it!

This topic is closed to new replies.

Advertisement