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 / I know i sound stupid but help me with PONG!

Author
Message
MoNkEyMaN
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: United Kingdom
Posted: 1st Feb 2003 12:55
Hi, I only started with DarkBasic a couple of day's ago and i'm stuck on my first game pong. I have managed to make the paddle (only one of them) move and the ball move but i cannot get the collision right on the paddle.
Pls help! My code is below:

MnKMaN
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 1st Feb 2003 14:05
Ok, the easiest way to get the collision on the paddle is to make a kind of collision box around it bysaying if the ball (sprite) is behind the paddle and in front of a certain distance behind the paddle and inbetween both sides of the paddle then your ball will change direction. eg...

if ball<paddlex and ball>paddlex-20 and ball<paddley+30 and ball >paddley-30 then change direction

Yum! Yum! Yum! Yum!
MoNkEyMaN
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: United Kingdom
Posted: 1st Feb 2003 15:06
Sorry Hamish, but what do you mean by ball?
Do you mean the x position of the ball?

MnKMaN
MoNkEyMaN
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: United Kingdom
Posted: 1st Feb 2003 15:17
Nevermind Hamish i figured out what ball was. 8)

Thanks for the help 8)

MnKMaN
Zero_Cool
21
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 2nd Feb 2003 00:04

Heres the code for my pong, it is advanced as pong can get which isnt sayin much, ill look on my pc for a more basic one

Zero_Cool
21
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 2nd Feb 2003 00:18
Also anyone know where i can upload the sounds and bitmap so you can see the full potential, i would acctualy like to upload the exe but apperantly it is to big for msn

Login to post a reply

Server time is: 2024-09-19 02:44:25
Your offset time is: 2024-09-19 02:44:25