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 / Make a ball bounce off a paddle (yes like pong) I'm making a breakout

Author
Message
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 7th Mar 2005 09:21
The Title Explains it. How do I make the ball bounce off the paddle.
I have the paddle move on a fixed y-axis (400) and the x variable is called x2. The ball moves with x+SpeedX and the same with Y. I made the ball bounce off the edge of the screen but I had help from the Book. Although I get how to do it. I have tried many attemps to get the ball to bounce off the paddle. I tried
if y=y2 and x=x2+10
speedX=-2
speedY=-5
endif
That wouldn't work no matter how hard I tried. Please Help.

___________________________________________________________
Visit my temp Page for video games!
http://www.freewebs.com/goodboys_dog
Underworld 1020
21
Years of Service
User Offline
Joined: 2nd Mar 2004
Location: NY, USA
Posted: 7th Mar 2005 09:57
Hold On...I'm writting some code that will help...

Underworld 1020
21
Years of Service
User Offline
Joined: 2nd Mar 2004
Location: NY, USA
Posted: 7th Mar 2005 10:17
This Code Should Work:


Hope It Helps .

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 7th Mar 2005 10:27
Underworld, please use the Edit button in future, thanks

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
Underworld 1020
21
Years of Service
User Offline
Joined: 2nd Mar 2004
Location: NY, USA
Posted: 7th Mar 2005 23:18 Edited at: 7th Mar 2005 23:22
...no problem

dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 8th Mar 2005 10:41
Thanks, I'll test it out to see if it works. Is this the code to make it bounce around the screen also??

___________________________________________________________
Visit my temp Page for video games!
http://www.freewebs.com/goodboys_dog
TravisP
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location: Behind you, with a knife!
Posted: 8th Mar 2005 12:22
Nice freakishly large sig. , underworld 1020, ill add it to my ad blocker.

Note: The above I didn't say, your just crazy.

Not a ripoff of The Twilight Zone
Underworld 1020
21
Years of Service
User Offline
Joined: 2nd Mar 2004
Location: NY, USA
Posted: 9th Mar 2005 06:48 Edited at: 9th Mar 2005 06:50
@vgames master - Yes, it will, the code makes a Ball bounce around, a Paddle move with the Left\Right keys, and it tests for collision between the ball and paddle. There are five different ways the ball can be hit depending on where the ball makes contact on the paddle, they should all work correct, but I didn't test it that much.

@Travis P - Well I like it because it get the point accross that METALLICA ROCKS!...

Login to post a reply

Server time is: 2025-05-23 19:05:45
Your offset time is: 2025-05-23 19:05:45