SYNC ON SYNC RATE 60 SET DISPLAY MODE 1024,768,32 HIDE MOUSE AUTOCAM OFF `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,10,10,200 position object 3,1,0,3000 glue object to limb 3,1,1 `Make matrix to walk on MAKE MATRIX 1,10000,10000,100,100 `Variables xPos 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 do `Store mouse movement mouseMovementX = MOUSEMOVEX() mouseMovementY = MOUSEMOVEY() `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,100,zPos ROTATE OBJECT 1,0,yAng,0 PITCH OBJECT DOWN 1,xLook POSITION CAMERA xPos,100,zPos ROTATE CAMERA xLook,yAng,0 Gosub Bullet SYNC loop Bullet: If crntbullet=0 and mouseclick()=1 if object exist(5) then delete object 5 Make object sphere 5,10 Position object 5,object position x(2),object position y(2),object position z(2) crntx=object position x(3)-(object position x(3)-object position x(2)) crnty=object position y(3)-(object position y(3)-object position y(2)) crntz=object position z(3)-(object position z(3)-object position z(2)) xmouse=mousex()/10 zmouse=mousex()/10 ymouse=mousey()/60 crntbullet=1 endif If crntbullet=1 crntx=crntx+xmouse crnty=crnty+ymouse crntz=crntz+zmouse position object 5,crntx,crnty,crntz If object position z(5)>3000 then delete object 5 : crntbullet=0 Endif Return