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 / why wont the ball move?

Author
Message
the chode
19
Years of Service
User Offline
Joined: 27th Apr 2005
Location: desert
Posted: 8th May 2005 04:32
The reason i put this in newcomers corner is because, well im a newcomer. i do not know what is wrong with my code! at first, i got it to make a red ball, then the camerawork was fine, but after putting the 'if then' commands, all i get is a black screen!

Dude
the chode
19
Years of Service
User Offline
Joined: 27th Apr 2005
Location: desert
Posted: 8th May 2005 04:33
btw i use dbc (dont think it matters for such a simple thing though.)

Dude
dlefik 2008
19
Years of Service
User Offline
Joined: 28th Apr 2005
Location: Spencerville, OH
Posted: 8th May 2005 05:02 Edited at: 8th May 2005 05:03
Ok, I'm kinda rushed but I took a quick look at it and here's what I noticed. The reason you got the black screen is because you forgot to put your sync in the main loop to refresh the screen. I've attached your code, but I modified it and remarked it so you could see what I did. It's not exactly what you had but its the same concept and if you study it enough it'll make good sense. I only made it move on the X axis but you could apply the same principle for the Y and Z axis. Click here--->
Hope this helps. If not I'll try to help more if I get the time if noone else has helped. BTW, sorry if it's confusing on what I did, I'm just not a very good teacher.
the chode
19
Years of Service
User Offline
Joined: 27th Apr 2005
Location: desert
Posted: 8th May 2005 05:28
thank you smiley, and i added the if then for the y axis as well, but there is one problem, the ball does go up and down, but only one 'jump' or something
sync on
`added this for smoother faster refresh rate or sync rate
sync rate 60

make object sphere 1,1
color object 1,rgb(255,0,0)

`changed this section. Just moved it out of the loop. This will define your initial starting place.
position object 1,-5,0,0
position camera 0,10,-10

do

`just modified this. different than what you had but gives you an example.
IF rightkey()=1 then playerXpos#=playerXpos#+0.5
IF leftkey()=1 then playerXpos#=playerXpos#-0.5
IF upkey()=1 then playerypos#=playerXpos+0.5
IF downkey()=1 then playerypos#=playerXpos-0.5
`position object 1,-5,0,0
`position camera 0,10,-10

point camera 0,0,0

`added this to update your new object position each time the program loops
position object 1,playerXpos#, playerYpos#, playerZpos#

`forgot this. Thats why you had the black screen.
sync

loop

Dude
dlefik 2008
19
Years of Service
User Offline
Joined: 28th Apr 2005
Location: Spencerville, OH
Posted: 8th May 2005 08:02
Ok, got you corrected here. Here's the modified code again. Take note of where I made changes. I left the old code that you put in there so you can compare the differences to mine to see what you did wrong.


Hope this helps.
the chode
19
Years of Service
User Offline
Joined: 27th Apr 2005
Location: desert
Posted: 8th May 2005 08:47
oops stupid me i left the variable thing out !

Dude
the chode
19
Years of Service
User Offline
Joined: 27th Apr 2005
Location: desert
Posted: 8th May 2005 08:54
and the y axis at the end. Yay i got it to work!


Dude

Login to post a reply

Server time is: 2024-09-23 19:23:20
Your offset time is: 2024-09-23 19:23:20