Thanks for the explanation. I think I'll try that, it might make the ramp better. I played with the get collision command a bit, and I have a ramp that you can go up. If anyone knows a better way to do this, let me know please.
sync on
hide mouse
sync rate 80
dim xspeed#(4)
dim zspeed#(4)
dim yspeed#(4)
dim friction#(4)
dim movedist#(4)
rem gravity constant
dim gravity#(0) : gravity#(0) = 0.75
load image "ground.bmp",1
make matrix 1,10000,10000,25,25
position matrix 1,-5000,0,-5000
randomize matrix 1,25
prepare matrix texture 1,1,1,1
set matrix texture 1,1,1
objx# = 0
objy# = 175
objz# = 0
make object box 1,30,20,40
position object 1,objx#,objy#,objz#
make object collision box 1,-15,-10,-20,15,10,20,0
make object box 2,150,50,150
xrotate object 2,25
position object 2,0,22,0
make object collision box 2,-75,-25,-75,75,25,75,0
friction#(1) = 0.96
movedist#(1) = 0.25
xspeed#(1) = 0
zspeed#(1) = 0
do
rem move object with arrow keys
if upkey()=1 then forward = 1 else forward = 0
if downkey()=1 then backward = 1 else backward = 0
if leftkey()=1 then left = 1 else left = 0
if rightkey()=1 then right = 1 else right = 0
rem update player
move(1,forward,backward,left,right)
tilt(1)
rem call the camera
cam(1)
rem update screen
sync
loop
function move(id,forward,backward,left,right)
rem get object's position and angle
xpos# = object position x(id)
ypos# = object position y(id)
zpos# = object position z(id)
yang# = object angle Y(id)
xang# = object angle x(id)
if forward = 1
xspeed#(id) = xspeed#(id) + newxvalue(0,yang#,movedist#(id))
zspeed#(id) = zspeed#(id) + newzvalue(0,yang#,movedist#(id))
endif
if backward = 1
xspeed#(id) = xspeed#(id) + newxvalue(0,yang#,movedist#(id)*-1)
zspeed#(id) = zspeed#(id) + newzvalue(0,yang#,movedist#(id)*-1)
endif
if left = 1
yrotate object 1,wrapvalue(yang# - 3)
endif
if right = 1
yrotate object 1,wrapvalue(yang# + 3)
endif
rem friction
xspeed#(id) = xspeed#(id) * friction#(id)
zspeed#(id) = zspeed#(id) * friction#(id)
yspeed#(id) = yspeed#(id) + gravity#(0)
xpos# = xpos# + xspeed#(id)
zpos# = zpos# + zspeed#(id)
ypos# = ypos# - gravity#(0)
if ypos# < get ground height(1,xpos#,zpos#)+10
yspeed#(id) = yspeed#(id) + (ypos# - get ground height(1,xpos#,zpos#))
ypos# = get ground height(1,xpos#,zpos#)+10
endif
if object collision(id,0)
set cursor 0,0
if get object collision x() > 0 then print "right"
if get object collision x() < 0 then print "left"
if get object collision y() < 0
print "top"
xrotate object id,curveangle(-25,xang#,10)
if forward = 1 then ypos# = ypos#+3 else ypos# = ypos# + gravity#(0)
endif
if get object collision y() > 0 then print "bottom"
if get object collision z() < 0
print "back"
xrotate object id,curveangle(-25,xang#,10)
if forward = 1 then ypos# = ypos#+3 else ypos# = ypos# + gravity#(0)
endif
if get object collision z() > 0 then print "front"
dec xpos#,get object collision x()
if get object collision y() > 0
dec ypos#,get object collision y()
endif
if get object collision z() > 0
dec zpos#,get object collision z()
endif
endif
position object id,xpos#,ypos#,zpos#
endfunction
function tilt(id)
xpos# = object position x(id)
ypos# = object position y(id)
zpos# = object position z(id)
yang# = object angle Y(id)
distval#=1
ang# = yang#
frontxval#=newxvalue(xpos#,ang#,distval#)
frontzval#=newzvalue(zpos#,ang#,distval#)
ang# = yang#+180
backxval#=newxvalue(xpos#,ang#,distval#)
backzval#=newzvalue(zpos#,ang#,distval#)
ang# = yang#+90
leftxval#=newxvalue(xpos#,ang#,distval#)
leftzval#=newzvalue(zpos#,ang#,distval#)
ang# = yang#-90
rightxval#=newxvalue(xpos#,ang#,distval#)
rightzval#=newzvalue(zpos#,ang#,distval#)
frontheight#=(get ground height(1,frontxval#,frontzval#))
backheight#=(get ground height(1,backxval#,backzval#))
leftheight#=(get ground height(1,leftxval#,leftzval#))
rightheight#=(get ground height(1,rightxval#,rightzval#))
xang#=curveangle((backheight#-frontheight#)*20,object angle x(id),25)
zang#=curveangle((leftheight#-rightheight#)*20,object angle z(id),25)
xrotate object id,xang#
zrotate object id,zang#
endfunction
function cam(id)
rem get object's position and angle
objx# = object position x(id)
objy# = object position y(id)
objz# = object position z(id)
objyang# = object angle Y(id)
rem variables
camdist# = 60
camh# = 30
rem get camera positions
camx# = newxvalue(objx#,objyang#+180,camdist#)
camz# = newzvalue(objz#,objyang#+180,camdist#)
camy# = objy#+camh#
rem update camera
position camera camx#,camy#,camz#
point camera objx#,objy#,objz#
endfunction