I'm not a fan of how this code works, in fact it doesn't in this form.
I modified the code just enough to get it to jump, but it needs a lot of cleanup.
Rem ***** Main Source File *****
` This code was downloaded from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com
`----------------------
`FPS Gun Movement Demo
`By Joseph Thomson
`28/01/04
`--------------------------------------------------------
`Please give credit to me if you use this code in any way
`--------------------------------------------------------
`Setup
SYNC ON
SYNC RATE 60
SET DISPLAY MODE 800,600,32
HIDE MOUSE
`Set gun holding-limb position
gunOffsetX AS FLOAT = 15.0
gunOffsetY AS FLOAT = -20.0
gunOffsetZ AS FLOAT = 20.0
`Make main player object and hide it
MAKE OBJECT CUBE 1,10
HIDE OBJECT 1
`Attach a limb and delete the mesh
MAKE MESH FROM OBJECT 1,1
ADD LIMB 1,1,1
DELETE MESH 1
`Make a weapon and attach it to the limb
MAKE OBJECT BOX 2,10,10,100
GLUE OBJECT TO LIMB 2,1,1
Make Object Box 3, 100,100,100
Position Object 3, 100,10,100
Make Object Box 4, 100,100,100
Position Object 4, 350,10,100
Make Object Box 5,100,100,100
Position Object 5,570,20,340
Make Object Box 6,100,200,400
Position Object 6,690,20,240
Make Object Box 7,70,350,500
Position Object 7,600,20,360
`Make matrix to walk on
MAKE MATRIX 1,10000,10000,100,100
`Variables
xPos AS FLOAT
yPos as float
zPos AS FLOAT
speed AS FLOAT = 10.0
xLook AS FLOAT
yAng AS FLOAT
lookSpeed AS FLOAT = 0.2
`The gun bobbing values
gunBobSpeed AS FLOAT = 6.0
gunBobMove AS FLOAT = 3.0
gunBobHeight AS FLOAT = 1.5
gunBobAng AS FLOAT
gunTurnAng AS FLOAT
gunLookAng AS FLOAT
mouseMovementX AS FLOAT
mouseMovementY AS FLOAT
JUMPING#=0
yPos=100
DO
`Store mouse movement
mouseMovementX = MOUSEMOVEX()
mouseMovementY = MOUSEMOVEY()
IF SPACEKEY()=1 AND JUMPING#=0 THEN JUMP#=1
IF JUMP#=1
GROUND#=OBJECT POSITION Y(1)
JUMP_SPEED#=1
JUMPING#=1
JUMP#=0
inc yPos,10.0
ENDIF
IF JUMPING#=1
DEC yPos,.1
POSITION OBJECT 1,OBJECT POSITION X(1),yPos, OBJECT POSITION Z(1)
IF OBJECT POSITION Y(1)<=GROUND# THEN JUMPING#=0
ENDIF
`Control movement using trig
IF Keystate(17)+ Keystate(31)+ Keystate(32)+ Keystate(30) > 0
IF Keystate(17) = 1
INC xPos,SIN(yAng)*speed
INC zPos,COS(yAng)*speed
ENDIF
IF Keystate(31) = 1
DEC xPos,SIN(yAng)*speed
DEC zPos,COS(yAng)*speed
ENDIF
IF Keystate(32) = 1
INC xPos,COS(yAng)*speed
INC zPos,-SIN(yAng)*speed
ENDIF
IF Keystate(30) = 1
DEC xPos,COS(yAng)*speed
DEC zPos,-SIN(yAng)*speed
ENDIF
` IF SPACEKEY()=1 AND JUMPING#=0 THEN JUMP#=1
`Increase gun-bobbing angle to get gun bobbing
gunBobAng = WRAPVALUE(gunBobAng+gunBobSpeed)
ELSE
`Otherwise slowly change the value to nothing to bring the gun to the centre again
gunBobAng = CURVEANGLE(0,gunBobAng,10)
ENDIF
`Control the gun swaying according to how much the player is turning
gunTurnAng = CURVEANGLE(WRAPVALUE(mouseMovementX),gunTurnAng,10)
gunLookAng = CURVEANGLE(WRAPVALUE(mouseMovementY),gunLookAng,10)
`Position the gun-holding limb and rotate it to give swaying effect
OFFSET LIMB 1,1,gunOffsetX+SIN(gunBobAng)*gunBobMove,gunOffsetY+ABS(COS(gunBobAng))*gunBobHeight,gunOffsetZ
ROTATE LIMB 1,1,gunLookAng,gunTurnAng,0
`Turn player
yAng = WRAPVALUE(yAng + mouseMovementX*lookSpeed)
xLook = WRAPVALUE(xLook + mouseMovementY*lookSpeed)
`Position player object and camera
POSITION OBJECT 1,xPos,yPos,zPos
ROTATE OBJECT 1,0,yAng,0
PITCH OBJECT DOWN 1,xLook
POSITION CAMERA xPos,100,zPos
ROTATE CAMERA xLook,yAng,0
set cursor 0,0
print "g=";GROUND#
print "js=";JUMP_SPEED#
print "jumping=";JUMPING#
print "j=";JUMP#
print "xPos=";xPos
print "yPos=";yPos
print "zPos=";zPos
SYNC
LOOP