Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Help with "Pong" game and 2D collision detection. Please

Author
Message
Bigdog
21
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 1st May 2003 00:00 Edited at: 1st May 2003 00:01
I am pretty new to progamming and so I thought I would make a simple "Pong" game. I was wondering if anyone can give me some help with it. Can someone please tell me the command that detects the collision between two 2D spites (The ball and slider) and how to use it. Thanks. Also if you have any other tips on how to make a good quality pong game they would be most appreciated. Like how to make the ball bounce back work "realistically" like in the original.

I have attached what I have done so far. If anyone need to take a look to help me. Basically the ball and slider move and thats it.

ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 1st May 2003 00:33
the command your looking for is
which checks for collision between sprites 1 and 2
heres my first pong game maybe you could learn something from that, i've tried to explain what each bit does in the code

ARE YOU A 3D MODELER??? IF SO WE NEED YOU!!!
EMAIL mynameisnoneofyourbuisness@hotmail.com to work on the new Star Strike project!!!
Amadeus
21
Years of Service
User Offline
Joined: 20th Apr 2003
Location: United States
Posted: 1st May 2003 00:37
well, for one, you can base the angle of the ball to move at double the angle of complement would be.


Eg:

|- represents middle of board
|O- the ball
======= - the board

if the ball hits the middle line and board from a 23o angle, simply invert it and place the 23o on the otehr side to bounce back. All the other places, you would need to figure out the point that the ball would eventually hit the middle line and somehow line it all up. Maybe that's pretty hard to understand, considering I'm rambling pretty badly.
=======

Life is a tale told by an idoit, full of sound and fury, signifying nothing. - MacBeth
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 1st May 2003 02:47 Edited at: 1st May 2003 02:59
pong had paddle reflection based on where the ball hit the paddle, so if hit in the center it bounces stright off and the closer to the edge of the paddle the greater the angle off it bounces. I have a pong game in the program section somewhere that does this.


It was the first thing I've programmed in several years and the first project I did with dark basic so I'm sure it's not the best but it does work.

http://www.darkbasicpro.com/apollo/view.php?t=6094&b=5

CTP

Bigdog
21
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 2nd May 2003 01:08
Thanks guys for all the help. I hvae finished my pong game and have attached the code if anyone else is thinking of having a go and needs a reference. You will of course need to make your own bongslider and ball.PNG. And the sounds but it is pretty good.

Login to post a reply

Server time is: 2024-11-24 12:34:01
Your offset time is: 2024-11-24 12:34:01