Graphics3D 800,600,16,1
SetBuffer BackBuffer()
Const CAMERA_COL = 1
Const level_COL = 2
Global camera=CreateCamera()
EntityType camera, CAMERA_COL
PositionEntity camera,5, 7, 0
;CAMERA
Global cam_x#,cam_z#,cam_pitch#,cam_yaw# ; Current
Global dest_cam_x#,dest_cam_z#,dest_cam_pitch#,dest_cam_yaw# ; Destination
terrain=LoadTerrain("tex3.bmp" )
TerrainDetail terrain,999,True
ScaleEntity terrain,10,1,10
grass_tex=LoadTexture("tex3.bmp" )
EntityTexture terrain,grass_tex,0,1
shoot=LoadSound("9mm.wav")
EntityPickMode terrain, 2
Global Gravity# = 0.16 ;Game gravity
Global PlayerGravity# = 0.0
;------------------------------meshes------------------------------------------------------------------------
;busch1-----------------------
busch1 = LoadMesh("m_tree6.3ds")
PositionEntity busch1, 35, 0.6, 35
ScaleEntity busch1, 1, 1, 1
;busch2-----------------------
busch2 = LoadMesh("m_tree5.3ds")
PositionEntity busch2, 39, 0.6, 36
ScaleEntity busch2, 1, 1, 1
;busch3-----------------------
busch3 = LoadMesh("m_tree4.3ds")
PositionEntity busch3, 60, 0.6, 45
ScaleEntity busch3, 1, 1, 1
;busch4-----------------------
busch4 = LoadMesh("m_tree6.3ds")
PositionEntity busch4, 60, 0.6, 75
ScaleEntity busch4, 1, 1, 1
;busch5-----------------------
busch5 = LoadMesh("m_tree6.3ds")
PositionEntity busch5, 30, 0.6, 30
ScaleEntity busch5, 1, 1, 1
;busch6-----------------------
busch6 = LoadMesh("m_tree5.3ds")
PositionEntity busch6, 60, 0.6, 89
ScaleEntity busch6, 1, 1, 1
;busch1-----------------------
busch7 = LoadMesh("m_tree4.3ds")
PositionEntity busch7, 60, 0.6, 60
ScaleEntity busch7, 1, 1, 1
;warrior1-----------------------
warrior = LoadMesh("warrior.3ds")
PositionEntity warrior, 50, 0.6,55
ScaleEntity warrior, 1,1, 1
RotateEntity warrior, 0,155,0
;olidrum1-----------------------
busch1 = LoadMesh("oildrum.3ds")
PositionEntity busch1, 38, 2.6, 55
ScaleEntity busch1, 0.1, 0.1, 0.1
;olidrum2-----------------------
busch1 = LoadMesh("oildrum.3ds")
PositionEntity busch1, 35, 2.6, 44
ScaleEntity busch1, 0.1, 0.1, 0.1
;wodcreat1----------------------
wcrate1 = LoadMesh("wcrate1.3ds")
PositionEntity wcrate1, 38, 2.6, 68
ScaleEntity wcrate1, 00.1,00.1,00.1
;wodcreat2----------------------
wcrate1 = LoadMesh("wcrate1.3ds")
PositionEntity wcrate1, 34, 2.6, 68
ScaleEntity wcrate1, 00.1,00.1,00.1
;wodcreat1----------------------
wcrate1 = LoadMesh("wcrate1.3ds")
PositionEntity wcrate1, 36, 6.6, 68
ScaleEntity wcrate1, 00.1,00.1,00.1
;gun1-----------------------------
gun1 =LoadMesh ("Tommy.3DS",camera)
ScaleEntity gun1, 5,5,5
texture=LoadTexture("tommy.bmp")
EntityTexture gun1,Texture
TranslateEntity gun1, .90, -.85,1
gun1ammo = 30
gun1reloads = 5
;gun2-------------------------------------
gun2 =LoadMesh ("Tommy.3DS")
PositionEntity gun2, 35,2.6,65.8
ScaleEntity gun2, 5,5,5
RotateEntity gun2, 270,0,90
texture=LoadTexture("tommy.bmp")
EntityTexture gun1,Texture
;cocke----------------------------
coke=LoadMesh("cokecan.3ds")
PositionEntity coke,33,4.9,68
ScaleEntity coke,00.1,00.1,00.1
;------------------------------sounds------------------------------------------------------------------------
;TYPES
Type hole
Field entity
End Type
hole = LoadSprite("flare.bmp")
HideEntity hole
EntityPickMode terrain, 2
Collisions 1, 2, 2, 3
Collisions 2, 1, 2, 3
Collisions CAMERA_COL,LEVEL_COL,3,1
While Not KeyDown(1) Or Collisions
; Mouse look
;-----------
; Mouse x and y speed
mxs=MouseXSpeed()
mys=MouseYSpeed()
; Mouse shake (total mouse movement)
mouse_shake=Abs(((mxs+mys)/2)/1000.0)
; Destination camera angle x and y values
dest_cam_yaw#=dest_cam_yaw#-mxs
dest_cam_pitch#=dest_cam_pitch#+mys
; Current camera angle x and y values
cam_yaw=cam_yaw+((dest_cam_yaw-cam_yaw)/5)
cam_pitch=cam_pitch+((dest_cam_pitch-cam_pitch)/5)
;Turn camera
RotateEntity camera, cam_pitch#/2,cam_yaw#/2,0
; Rest mouse position to centre of screen
MoveMouse 400,300
If KeyDown( 57 ) =1 And Jumped =0 ;Jump check
PlayerGravity# = 2.5
Jumped =1
EndIf
If KeyDown( 54 ) =1 ;Walk key (Right Shift)
WalkSpeed# = .05
Else
WalkSpeed# = .5
EndIf
If KeyDown( 157 ) =1 ;Fly mode (Right CTRL)
FlyMode=1
Else
FlyMode=0
EndIf
If MouseHit(1)
CameraPick(camera, MouseX(), MouseY())
h.hole = New hole
h\entity = CopyEntity(hole)
PositionEntity h\entity, PickedX(), PickedY(), PickedZ()
EndIf
If MouseHit(1) Then PlaySound=shoot
If KeyDown( 32 )
TurnEntity camera,0,-5,0
EndIf
If KeyDown( 30 )
TurnEntity camera,0,5,0
EndIf
If KeyDown( 31 )
MoveEntity camera,0,0,-0.15
EndIf
If KeyDown( 17 )
MoveEntity camera,0,0,0.15
EndIf
RenderWorld
Flip
TranslateEntity camera, 0, -1, 0
Wend