Skip to main content
GameDev.net gamedev.net
🔒 Locked

simple game

Started by phil67rpg May 9, 2012 at 2:59 AM 5 replies 1.8k views
Original Post
phil67rpg
phil67rpg
I am developing a game where a space ship shoots bricks at the top of the screen from the bottom of the screen. I have done alot of research on collision detection and bounding boxes in particular but I am still confused about how to implement a good collision detection routine.If you know of any really good web sites please share them with me.
marvel_magnum
marvel_magnum
For collision detection for shooting bricks, you could just go with the InsersectRect() function as the bullets would just travel straight up and always hit from below (I'm assuming). That should mostly suffice your needs depending on what you want to do. If it was a ball/brick collision like BreakOut, now that's a different story. wink.png
phil67rpg
phil67rpg
actually it is like breakout,but I will try IntersectRect() method.
jefferytitan
jefferytitan
You may experience the problem of your bullets travelling too fast, e.g. gone all the way past a brick without a collision in one time step. In that case intersecting a line with a rectangle might make more sense, e.g. the line from bullet_old_y to bullet_new_y.
marvel_magnum
marvel_magnum

You may experience the problem of your bullets travelling too fast, e.g. gone all the way past a brick without a collision in one time step. In that case intersecting a line with a rectangle might make more sense, e.g. the line from bullet_old_y to bullet_new_y.


Thank you jefferytitan. I forgot to mention that part. smile.png
phil67rpg
phil67rpg
thanks for all the help,
phil67rpg
phil67rpg
I am currently working on a breakout/space invaders cross.I am using dx9 and c++.There sure is alot to learn but things are going along nicely.the hardest part is the collision detection.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.