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 / Pong Game Help

Author
Message
comando 300
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 17th Jan 2004 20:16
Now I'm trying to make a 2D Pong game.
Well, my problem is to get the ball move in angle when the ball hit a corner of the paddle.

Here's the part of my code of the ball's movement



Any help will be welcome

Is just of those days when you don't wanna wake up everything is *****, everybody sucks you really don't know why, but you wanna justify rippin' someone head off!
BearCDPOLD
20
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 19th Jan 2004 05:12
Always have the ball moving one pixel at a time. To determine how fast it goes, have it move 1 pixel per <insert number herer> milliseconds. If you detect collision, reverse the negative & positive signs, and it will go around at a bunch of pretty angles. I was doing this awhlie ago in Qbasic, and was just being lazy about writing the bouncing algorithms, and this simple little calculation was perfect.

Juvenile Industries
Current Project: KillZone(FPS)
Soon to come:An rts, and a snowball fight game
comando 300
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 19th Jan 2004 06:05
How I can move a pixel at a time?

I have DBC!

Is just of those days when you don't wanna wake up everything is *****, everybody sucks you really don't know why, but you wanna justify rippin' someone head off!
Represent
20
Years of Service
User Offline
Joined: 24th Dec 2003
Location:
Posted: 19th Jan 2004 17:20
@Comando300-

Heres a pong code I found on the code snippets forum. It works in DBC or DBP.



Hope that helps.
comando 300
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 22nd Jan 2004 21:03
IF upkey() = 1 then player_y(2) = player_y(2) - 10
IF downkey() = 1 then player_y(2) = player_y(2) + 10
IF ballx_dir = 0 then DEC ball_x, ball_speed
IF ballx_dir = 1 then INC ball_x, ball_speed
IF bally_dir = 0 then DEC ball_y, ball_speed
IF bally_dir = 1 then INC ball_y, ball_speed
IF ball_y < 1 then bally_dir = 1
IF ball_y > 475 then bally_dir = 0

That part of the code is for to detect the edges collsion and bounce.But for just work once :S :<


What's wrong?

Is just of those days when you don't wanna wake up everything is *****, everybody sucks you really don't know why, but you wanna justify rippin' someone head off!
comando 300
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 22nd Jan 2004 21:07
IF upkey() = 1 then player_y(2) = player_y(2) - 10
IF downkey() = 1 then player_y(2) = player_y(2) + 10
IF ballx_dir = 0 then DEC ball_x, ball_speed
IF ballx_dir = 1 then INC ball_x, ball_speed
IF bally_dir = 0 then DEC ball_y, ball_speed
IF bally_dir = 1 then INC ball_y, ball_speed
IF ball_y < 1 then bally_dir = 1
IF ball_y > 475 then bally_dir = 0

That part of the code is for to detect the edges collsion and bounce.But for me just work once :S :<


What's wrong?

Is just of those days when you don't wanna wake up everything is *****, everybody sucks you really don't know why, but you wanna justify rippin' someone head off!
comando 300
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 23rd Jan 2004 00:47
sorry for my double post

Is just of those days when you don't wanna wake up everything is *****, everybody sucks you really don't know why, but you wanna justify rippin' someone head off!
Chris K
20
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 23rd Jan 2004 20:33
Triple post

Login to post a reply

Server time is: 2024-09-21 18:27:07
Your offset time is: 2024-09-21 18:27:07