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.

2D All the way! / need help moving a ball

Author
Message
ATBGrafix
19
Years of Service
User Offline
Joined: 8th Mar 2007
Location: Nashville, TN USA
Posted: 8th Mar 2007 15:03
I'm creating a breakout'ish game for my high school programming class, and I need some help moving the ball.
I'm using DB Classic.

Basically, the ball will stay in the upper left corner and not move, but the other functions such as the paddle function works fine, so to me, it seems like the ball function is "resetting" each time, and the ball pastes in the same spot.
How do I fix this

Heres the code for the ball function.


thanks
Scraggle
Moderator
22
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 8th Mar 2007 17:43
Without seeing the rest of the code, we can only guess. Here is my guess:
I am going to go out on a limb and say that you have not set any of the variables to global. So inside the function they are all zero.

However, it should never get as far as the Move Balls function because there is no () after the declaration. So, you should really be getting an error at compile time.



ATBGrafix
19
Years of Service
User Offline
Joined: 8th Mar 2007
Location: Nashville, TN USA
Posted: 8th Mar 2007 18:11
how would I do this DB classic? The () is not there cause I disabled it temporarily.

Basically, I need a lesson on how to return values with functions.
ATBGrafix
19
Years of Service
User Offline
Joined: 8th Mar 2007
Location: Nashville, TN USA
Posted: 8th Mar 2007 18:28
and how do I return all 4 values(ballx, bally, ballspeedy, ballspeedx) in one function?
Scraggle
Moderator
22
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 9th Mar 2007 15:53
Like I said above, set them all as Global variables.



ATBGrafix
19
Years of Service
User Offline
Joined: 8th Mar 2007
Location: Nashville, TN USA
Posted: 9th Mar 2007 22:25
can't, like I said, I'm using DB Classic, can't set variables as global in classic.
Quisco DaLuse
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 10th Mar 2007 16:52
ATB - You can use arrays to control the ball. An example:


You idiots! You've captured their stunt doubles!

Login to post a reply

Server time is: 2026-07-05 18:09:29
Your offset time is: 2026-07-05 18:09:29