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 / ball, dont want to move

Author
Message
Slooper
21
Years of Service
User Offline
Joined: 13th Feb 2003
Location: Sweden
Posted: 15th Mar 2005 04:54 Edited at: 15th Mar 2005 05:30
can someone please tell me why the ball doesn´t move at all?

(Attached the game to, becuse i use some own models)




You never fail, only make mistakes.

Attachments

Login to view attachments
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 15th Mar 2005 05:00 Edited at: 15th Mar 2005 05:01
Looks like you need to make you variables Global:

Global p1mvu
Global p1mvd
...and so on...

These have to be done outside of functions.

Also, looks like you might be misunderstanding the Inc function. It's not "Include", its "Increment", which simply adds to the variable's value (like x=x+1).

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Slooper
21
Years of Service
User Offline
Joined: 13th Feb 2003
Location: Sweden
Posted: 15th Mar 2005 05:07
ok the thing you explained wih the inc command i understand but the

Global p1mvu
Global p1mvd

dont need to be done becuse the players do move but i dont understand why the ball doesn´t move

any other suggestion please

You never fail, only make mistakes.
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 15th Mar 2005 05:28
He meant you would need to set the ball x,y and z to global aswell as remember in functions they are global vaiables, so are not remembered next time the function is called.
Slooper
21
Years of Service
User Offline
Joined: 13th Feb 2003
Location: Sweden
Posted: 15th Mar 2005 05:37
ok baggers i really still don´t understand, can you show me in the code what you do mean? sry i am a really noob to programming.

You never fail, only make mistakes.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 15th Mar 2005 05:39 Edited at: 15th Mar 2005 05:40
Whilst all the points raised so far are valid none of them will help you because the ballx, bally and ballz variables are all created and incremented within the function. So, making them global will not help you.

The problem is - they are being treated as integer variables and you cannot increment an integer by a floating value.

The solution is to make the three ball variables floats. There are two ways to do this. Either call them ballx#, bally# and ballz# or set them globally at the start of the code with the commands:
Global ballx as float
Global bally as float
Global ballz as float

I hope that helps

Slooper
21
Years of Service
User Offline
Joined: 13th Feb 2003
Location: Sweden
Posted: 15th Mar 2005 05:45
hmm Scraggle i tried that with renaming them to ballx#, bally# and ballz# but it didnt work, as you can see i attached the game in my first post can´t you download it and try to figure it out this problem really going on my nerves

You never fail, only make mistakes.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 15th Mar 2005 05:51 Edited at: 15th Mar 2005 05:52
It works when I try it!

Here is the code exactly as you have it but with the ball variables as floats (maybe, you didn't change all of them?).



Slooper
21
Years of Service
User Offline
Joined: 13th Feb 2003
Location: Sweden
Posted: 15th Mar 2005 05:59
hehe tnx i worked i forgot to change the

position object 3,ballx,bally,ballz

to

position object 3,ballx#,bally#,ballz#

tnx m8

You never fail, only make mistakes.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 15th Mar 2005 06:01
No problem - Glad I could help

Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 15th Mar 2005 06:02
Oh yeah !...dunno how i missed that !
Nice one scraggle
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 15th Mar 2005 06:26
Me too! Good catch!

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II

Login to post a reply

Server time is: 2024-11-13 20:04:37
Your offset time is: 2024-11-13 20:04:37