Quote: " The Jumping is a little awkward.. i.e. if you let go you plummet down as if gravity were much stronger. How do I fix that."
We can adjust the jumping smooth modifying the gravity value, and the
( keystate(57) ) when we press Spacekey: change this piece of code
Quote: "rem colision de camara con el fondo
if static volume(cox#,coy#-10,coz#,cmx#,cmy#-10,cmz#,1.0)=1
materialtype=get static collision value()
cmx#=cox#+get static collision x()
cmy#=coy#+get static collision y()
cmz#=coz#+get static collision z()
grav#=0.2
else
inc grav#,0.2
endif
rem salto
if tkeystate57=1
cmy#=cmy#+2
endif
"
Here's the complete code:
autocam off
rem load your level
gdividetexturesize=0 : universefile$="levelbank\testlevel\universe.dbo"
set dir "Files" : load static objects universefile$,gdividetexturesize
rem camera position
position camera 0, 50,55,-40
point camera 100,70,-100
set ambient light 0
rem Main loop
backdrop on : hide mouse
sync on : sync rate 55
disable escapekey
rem loading the gun
load object "media\mp5.dbo",3
yrotate object 3,180
fix object pivot 3
while escapekey()=0
rem screen Data
text 0,0," FPS: "+str$(screen fps())
text 0,20," POLIGONOS: "+str$(statistic(1))
text 0,40," Camara X: "+str$(camera position x())
text 0,60," Camara Y: "+str$(camera position y())
text 0,80," Camara Z: "+str$(camera position z())
rem Control camera
gosub _camera
`
rem SYNC
sync
`
endwhile
rem deleting levewl
delete static objects
rem game end
end
_camera:
rem arrowkeys and a,s,d,w keys
tkeystate30=0 : tkeystate32=0 : tkeystate17=0 : tkeystate31=0 : tkeystate57=0
if keystate(17) or keystate(200) then tkeystate17=1
if keystate(31) or keystate(208) then tkeystate31=1
if keystate(30) or keystate(203) then tkeystate30=1
if keystate(32) or keystate(205) then tkeystate32=1
if keystate(57) then tkeystate57=1
cammovex#=mousemovex()
cammovey#=mousemovey()
if mouseclick()=1 then set static portals on : set static objects wireframe on
if mouseclick()=0 then set static portals off : set static objects wireframe off
rem old camera position
cox#=camera position x()
coy#=camera position y()
coz#=camera position z()
rem camera movements
movement=0 : speed#=3.0
x#=camera angle x() : z#=camera angle z() : sy#=camera angle y() : y#=sy#
if tkeystate30=1 then dec y#,90 : movement=1
if tkeystate32=1 then inc y#,90 : movement=1
rotate camera 0,y#,0
if tkeystate17=1 or tkeystate30=1 or tkeystate32=1 then move camera speed# : movement=1
if tkeystate31=1 then move camera speed#*-1.0 : movement=1
rotate camera x#,sy#,z#
rem new camera position
cmx#=camera position x()
cmy#=camera position y()-grav#
cmz#=camera position z()
rem camera collision
if static volume(cox#,coy#-10,coz#,cmx#,cmy#-10,cmz#,1.0)=1
materialtype=get static collision value()
cmx#=cox#+get static collision x()
cmy#=coy#+get static collision y()
cmz#=coz#+get static collision z()
grav#=0.2
else
inc grav#,0.2
endif
rem JUMP
if tkeystate57=1
cmy#=cmy#+2
endif
rem camera limits
if cmy#<-200.0 then cmy#=-200
rem Update camara
set point light 0,cmx#,cmy#,cmz#
position camera cmx#,cmy#,cmz#
rem gun in first person
camangx#=camera angle x()+cammovey#/1.5
camangy#=camera angle y()+cammovex#/1.5
if wrapvalue(camangx#)>85 and wrapvalue(camangx#)<180 then camangx#=85.0
if wrapvalue(camangx#)>180 and wrapvalue(camangx#)<275 then camangx#=275.0
rotate camera camangx#,camangy#,camera angle z()
position object 3,camera position x(),camera position y(),camera position z()
set object to camera orientation 3
move object down 3,1.5
move object right 3,1
move object 3,2
return
Cheers.
I'm not a grumpy grandpa
