#### Archived

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

# collosion detection

This topic is 6211 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
Well, it would help if you were a little more specific...

------------------------------
#pragma twice

##### 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 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!

##### Share on other sites
Ok, here are a few questions for you:

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 on other sites
I wrote a game like that long ago.

Here is the source code:

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

##### Share on other sites
? Shadrack never got back to the board about wot happened to his game ? .. hmm ..

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

Here is the source code:

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

where do we get this libCON.dll ? ..

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 14
• 13
• 9
• 12
• 9
• ### Forum Statistics

• Total Topics
631438
• Total Posts
3000073
×