Hi,
Is this what you're trying to do?:
set display mode 1024,768,32;sync on;sync rate 70
for x=0 to 100
for y=0 to 100
ink rgb(0,rnd(255),0),0
dot x,y
next y
next x
sync
get image 1,1,1,100,100
set text size 12;center text screen width()/2,screen height()/2,"Loading..."
autocam off;position camera 50,10,0;hide mouse
`//SET VARIABLES
sens#=30
type vector3
x as float
y as float
z as float
endtype
PlayerSpeed as vector3
MaxSpeedPlr#=0.8
MinSpeedPlr#=-0.8
gravity#=0.5
`//LOAD WORLD
center text screen width()/2,(screen height()/2)+20,"World"
make matrix 1,250,250,25,25
randomize matrix 1,4
prepare matrix texture 1,1,1,1;
update matrix 1
cls
`//LOAD 3D OBJECTS
center text screen width()/2,screen height()/2,"Loading...";center text screen width()/2,(screen height()/2)+20,"Objects"
cls
`//MAIN PROGRAM LOOP
do
gosub _PlayerPhysics
gosub _PlayerMove
gosub _MouseLook
gosub _EnvData
sync
loop
`//SUBROUTINES
_PlayerPhysics:
ground#=get ground height(1,camera position x(),camera position z())
if spacekey()=1 and camera position y()<ground#+7 then playerspeed.y=3
playerspeed.y=playerspeed.y-0.25
position camera camera position x(),camera position y()+playerspeed.y,camera position z()
if camera position y()<ground#+5
playerspeed.y=playerspeed.y*0.2
position camera camera position x(),ground#+5,camera position z()
endif
return
_PlayerMove:
PlayerSpeed.z=PlayerSpeed.z+0.1*(keystate(17)-keystate(31))
PlayerSpeed.x=PlayerSpeed.x+0.1*(keystate(30)-keystate(32))
PlayerSpeed.z=PlayerSpeed.z*0.95
PlayerSpeed.x=PlayerSpeed.x*0.95
move camera PlayerSpeed.z
yrotate camera wrapvalue(Camera angle y()-90)
move camera playerspeed.x
yrotate camera wrapvalue(Camera angle y()+90)
return
_MouseLook:
yrotate camera wrapvalue( camera angle y()+((mousemovex()*sens#)/100.0) )
xrotate camera wrapvalue( camera angle x()+((mousemovey()*sens#)/100.0) )
if camera angle x() > 80 and camera angle x()<180 then xrotate camera 80
if camera angle x() < 360-80 and camera angle x()>180 then xrotate camera -80
return
_EnvData:
text 0,0,"CamPosX = " +str$(camera position x())
text 0,10,"CamPosY = " +str$(camera position y())
text 0,20,"CamPosZ = " +str$(camera position z())
text 0,30,"---------------"
text 0,40,"CamAngX = " +str$(camera angle x())
text 0,50,"CamAngY = " +str$(camera angle y())
text 0,60,"CamAngZ = " +str$(camera angle z())
text 0,70,"---------------"
text 0,80,"Scancode = " +str$(scancode())
text 0,90,"---------------"
text 0,100,"Player Speed = " +str$(PlayerSpeed.z)
text 0,110,"Gravity = " +str$(gravity#)
text 0,120,"Jump Strength = " +str$(jump#)
return
instead of just having one speed for the player, it has a forward speed(playerspeed.z), a strafe speed(playerspeed.x) and a vertical/jump speed(playerspeed.y).
-----------------------------------
To delete the bug, delete the code.
Specs: Sony VAIO Laptop, Windows XP, P4 2.8Ghz, 512MB RAM, ATI Radeon 64MB video memory, DBP Upgrade 5.3.