I just fixed it i think. I don't know how fast you want the sphere to move, but now it accelerates to 1 nicely. The error was this bit of code:
Why do you declare it as an integer if it needs to be a float?
change it to this:
You should also change all the other "as integer" to this too, since i can see that there ment to be floats too.
See, integers can't store decimal numbers. That's what the data type Floats are for
As i think you know, you declare a float with the sign #.
Well, here are the changed code. This works nicely
:
REM Project: road game
REM Created: 10/13/2005 5:36:08 PM
REM
REM ***** Main Source File *****
REM
`normal stuff
sync on
sync rate 30
autocam off
`declare variables
playerangle# as float
playerx# as float
playery# as float
playerz# as float
rate# as float
rate#=0
`make matrix a load its texture file
load image "textures.png",1,1
make matrix 1,160,1000,16,100
prepare matrix texture 1,1,3,2
`make player sphere
make object sphere 1,10
color object 1,RGB(0,0,200)
position object 1,80,0,0
`set height of left bank
for t=0 to 2
for i=0 to 100
set matrix height 1,t,i,5
next i
next t
`set height of right bank
for t=14 to 16
for i=0 to 100
set matrix height 1,t,i,5
next i
next t
`set height of curve in road
for t=0 to 100
set matrix height 1,7,t,0.25
set matrix height 1,8,t,0.4
set matrix height 1,9,t,0.25
next t
`set grass texture for left bank
for t=0 to 4
for i=0 to 99
set matrix tile 1,t,i,3
next i
next t
`set grass texture for right bank
for t=11 to 15
for i=0 to 99
set matrix tile 1,t,i,3
next i
next t
`set middle of road texture
for t=7 to 8
for i=0 to 99
set matrix tile 1,t,i,5
next i
next t
`set left and right lines on road
for t=0 to 99
set matrix tile 1,6,t,4
set matrix tile 1,9,t,6
next t
`update changes to matrix
update matrix 1
`position starting point of camera
position camera 80,50,0
point camera 80,0,400
`colour the backdrop nice and blue
color backdrop RGB(100,100,255)
do
if upkey()=1 then rate#=rate#+0.1
if upkey()=0 then rate#=rate#-0.1
if downkey()=1 then move object 1,-0.1
if leftkey()=1 then playerangle#=playerangle#-3
if rightkey()=1 then playerangle#=playerangle#+3
if rate#>1 then rate#=1
if rate#<0 then rate#=0
move object 1,rate#
playerangle#=wrapvalue(playerangle#)
playery#=get ground height(1,object position x(1),object position z(1))+5
yrotate object 1,playerangle#
position object 1,object position x(1),playery#,object position z(1)
set camera to follow object position x(1),playery#,object position z(1),playerangle#,30,playery#+5,10,1
text 0,0,"Rate# variable: "+str$(rate#)
text 0,15,"Screen FPS: "+str$(screen fps())
text 0,30,"Scancode reading: "+str$(scancode())
sync
loop
PanzerGames
here
Free Particle Engine For dbpro :
here