Archived

This topic is now archived and is closed to further replies.

Shadrack

collosion detection

Recommended Posts

Can someone please help me!!!! I am writing a game call smash, The game is a cross between Air Hockey and Breakout. Just like air hockey I want the mouse I want the mouse to hit the ball. I''ve tried different source codes, but still no joy. So please help me.

Share this post


Link to post
Share on other sites
quote:
I want the mouse I want the mouse to hit the ball. I've tried different source codes, but still no joy. So please help me.


Holy crapamoli! You've got one heck of a problem there! LOL



Matthew Fitzgerald (Maketty),
Knightvision Games

Edited by - maketty on October 5, 2000 3:19:26 PM

Share this post


Link to post
Share on other sites
I would never start a post like this. This way you'' ve got a 99.9% chance that no one answers. And the 00.01% will probably play jokes on you ...
Because of the fact that I answered I am one of the 00.01%. But I can''t remember of any joke right now, sorry!

Next time you''ll get your joke, just make your headline 500 billion pixel big, promised!

Share this post


Link to post
Share on other sites
Ok, here are a few questions for you:

1.) Are you already having your paddle or ''avatar'' move(track) with the mouse.

2.) Is this game 2d or 3d or somewhere in between?

If it is 2d and you already have the paddle track the mouse you just need to have the ''ball'' or whatever store its own position and do the same with your paddle. More than likely the position of the two objects will actually only be the point at there top left corner. From that point you need to make a bounding rectangle to check for a collision.

Take the x position point and store it in a variable that represents the left edge of the object. Do the same for the y position point(it represents the top. Now add the width of the object to the original point and store it in a variable for the right side. Find the bottom end of the object by adding the height and storing it like you have stored all the other variables.

You now have a bounding rectangle. If all objects have this same scheme, it becaomes trivial to check to see if they have collided. i.e.

if (player.top > missle.bottom)
collision = false;

etc etc.....

This is a poor way to check for a collision, but it should help you get some basics in your game. You can refine it later. There are lots of papers on the net on collision detection, you should try finding some. There are even some on this site. If I misunderstood your question be a little more clear and re post your q. If I have time i''ll try and answer it. Good luck with your game....



Share this post


Link to post
Share on other sites
I wrote a game like that long ago.

Here is the source code:
http://photoneffect.com/download/demos/stanga.zip

(It won''t run without the libCON.dll though)

Share this post


Link to post
Share on other sites
quote:
Original post by Photon
I wrote a game like that long ago.

Here is the source code:
http://photoneffect.com/download/demos/stanga.zip

(It won''t run without the libCON.dll though)


where do we get this libCON.dll ? ..

Share this post


Link to post
Share on other sites