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 / Problem with pong game

Author
Message
Josh226
17
Years of Service
User Offline
Joined: 8th Dec 2006
Location:
Posted: 10th Dec 2006 13:42
I made a pong game from the "My First Pong Game" tutorial but changed it alot to make it full screen. The problem is the ball bounces whenever the pads are moving even if it doesn't hit the pads, eg if you just hold up and the ball hits the bottom left on the screen it will still bounce off as if it hit a pad.

This is my full code:

Does anyone know how i can fix it so the ball will only bounce of the pads.
Inverted
18
Years of Service
User Offline
Joined: 19th Nov 2006
Location: Oregon
Posted: 10th Dec 2006 17:01
It works fine for me.
Are you using DBP?

Also, change the controls to match the right side of the screen.

Opposites are different, not wrong
lower logic
18
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 10th Dec 2006 18:58
Yeah I see that the problem exists, it doesnt happen all the time but it still happens. I can't figure out where or why its happening. I'd start by printing things like "player1pos#-ballz#" to the screen and make sure the values make sense while you're playing the game. Oh and just a tip, instead of using angles for the direction of the ball, I'd make 2 variables that kept track of the x and z velocities of the ball, so that when the ball hits a wall you can just say "ballZvelocity = -ballZvelocity" so the ball reverses direction along the Z axis, and the same thing would work for bouncing off the X axis.
Josh226
17
Years of Service
User Offline
Joined: 8th Dec 2006
Location:
Posted: 10th Dec 2006 19:15
Yeah im using DBP and this is the first program i'v made on it so im not very good at it yet.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 11th Dec 2006 01:53
Why not do a 2D version first and then when you know what you are doing switch to 3D? It would probably be quicker in the longrun... and you would learn more!

TDK_Man

Login to post a reply

Server time is: 2024-11-27 01:58:14
Your offset time is: 2024-11-27 01:58:14