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.

DarkBASIC Discussion / Pong Anyone?

Author
Message
Deidara Akatsuki
16
Years of Service
User Offline
Joined: 31st Jan 2009
Location:
Posted: 4th Apr 2009 05:08
Okay, So i'm remaking the original Pong in 3d, but from a birds-eye-view, but i cant get the ball to "ricochet" off the paddles. Any Ideas will be greatly appreciated.
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 4th Apr 2009 16:00
How about you remake the original pong in 3d, but from a birds-eye-view and have the ball "ricochet" off the paddles?

What collision are you using? The built-in, or an external DLL?

Plus, some could would help. You can paste it in to the reply box, highlight it, and press the code button up at the top.

That's what they WANT you to think...
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 4th Apr 2009 18:28
Quote: "Deidara:
Okay, So i'm remaking the original Pong in 3d, but from a birds-eye-view, but i cant get the ball to "ricochet" off the paddles."


Quote: "Quirky:
How about you remake the original pong in 3d, but from a birds-eye-view and have the ball "ricochet" off the paddles?"


Ummmmm you both said the same thing.....


Now On Topic:


If Your not already i would suggest using sparkys collision dll.

It uses raycasting and you can get the direction that a object would move if it hit another object (a ricochet)

Search the forums theres a download somewhere on here.

New Site! Check it out \/
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 4th Apr 2009 18:49
Quote: "Ummmmm you both said the same thing....."


That's the point.

That's what they WANT you to think...
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 4th Apr 2009 21:11
All sarcasm aside, here:

Keep track of the balls X axis and X axis movement separately.

When it hits the paddle, just multiply the correct one by (-1) (and perhaps a multiplier to change the speed, but that isn't important at first).

This also works to have it bounce off of the top and bottom. No DLL required.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 5th Apr 2009 02:27
BN2 has the right approach.

can't read?
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 5th Apr 2009 04:32
right so:



the reason im using the .5 * sprite height(ball) is bcuz this will return the value causing the ball to be touching the top/bottom of the screen, but u can substitute in an exact value if u dont want it to be right on the edge
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 5th Apr 2009 04:50
remember to do stuff like
if x > 300 then x=299
When you are checking a boundary (and get a collision) you have to reposition slightly inside the boundary or it will set off the collision again.

can't read?
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 5th Apr 2009 05:05
right, nice obese
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 5th Apr 2009 22:43
Quote: "BallY = BallY * -1"


ummm i don't think thats right. you need to make it so the movement speed is a variable then do:

Speed = Speed * -1

Right? lol yours would make you ballY coordanet a negative number

New Site! Check it out \/
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 5th Apr 2009 23:08 Edited at: 5th Apr 2009 23:09
bally/ballx r sorta flags for telling if the ball is moving left/right/up/down, so the main loop contains

x=x+ballx
y=y+bally

where x/y is the coordinate of the ball

i c wat ur sayin, i dont know y i used bally and ballx for this purpose, i shouldve used those 4 the coordinates of the ball, then used xflag and yflag or xspeed and yspeed instead for directional flags

There are only 10 kinds of people in the world, those who understand binary and those who dont
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 5th Apr 2009 23:33
Oh Ok i thought they were the balls' x and y positions. lol then great you got it lol

New Site! Check it out \/
Deidara Akatsuki
16
Years of Service
User Offline
Joined: 31st Jan 2009
Location:
Posted: 5th May 2009 04:43
Thanks for the help. I haven't gotten it fully working yet, but i've gotten somewhere with these tips, so thank you!

Login to post a reply

Server time is: 2025-08-08 20:42:27
Your offset time is: 2025-08-08 20:42:27