@jhocking: Here...
;base game engine for school project
.beginworld
;loads graphics buffer and resolution
AppTitle "Rome: Rich vs. Poor
Graphics3D 1024,768
SetBuffer BackBuffer ()
.openworldprog
;Particle emitter by Wiebo de Wit
Include "include_school.bb"
p_setup
p_setwind(-45,0.0005)
;GLOBALS
Global floor1
Global x#,y#,z#,terra_y#,zz#,ww#
Global camera_pivot
Global health# = 100,numhi,numlo
Global endGame = LoadImage("endgame.png")
Dim roads(15)
Dim seto(17)
Global alive = True
Global ascend# = 6
Global camflip = False
Global waitum =12
;collision globals
Global SCENERY = 1
Global PLAYER = 2
Global PROPS = 4
Global CARPET = 5
Global bldg1 = 6
;other files to include
Include "numbers.bb"
Include "schoolprops.bb"
;light
Global light = CreateLight()
RotateEntity light, 90,0,0
;camera time
camera_pivot= CreatePivot()
;this caused error EntityRadius camera_pivot,1.4,1
EntityRadius camera_pivot,1.4
EntityType camera_pivot,PLAYER
Global camera = CreateCamera(camera_pivot)
CameraRange camera,1,1000
CameraFogMode camera,1
CameraFogRange camera,60,200
Global cam2 = CreateCamera(camera_pivot)
;rotate it
RotateEntity cam2, 0,180,0
;hide it
HideEntity cam2
;specify viewport
CameraViewport cam2,30,40,160,110
;sky view
Global sky = CreateSphere(16,camera_pivot)
FlipMesh sky
ScaleEntity sky,100,100,100
PositionEntity sky, 0,50,0
sky_tex = LoadTexture("sky.bmp")
EntityTexture sky,sky_tex
;terrain view
Global terrain = LoadTerrain("height2.jpg")
TerrainDetail terrain,2500,True
ScaleEntity terrain, 3,15,3
PositionEntity terrain,-1000,0,-530
ter_tex = LoadTexture("mossyground.bmp")
EntityTexture terrain,ter_tex
EntityRadius terrain,0.2
EntityType terrain,SCENERY
;Position the camera
PositionEntity camera_pivot, 71.7469,6.73231,103.762
;Collision Handling
Collisions CARPET,SCENERY,2,1
Collisions PLAYER,PROPS,2,1
;Collisions PLAYER,CARPET,2,3
Collisions PLAYER,PLAYER,2,1
;cutscene initiation example code
;If EntityX(camera_pivot) = 60 And EntityY(camera_pivot) = 7 And EntityZ(camera_pivot) = 100
;Graphics3D 1024,768
;imgtest = LoadImage ("victory.jpg")
;DrawImage imgtest,0,0
;Flip
;WaitKey
;Goto beginworld
;EndIf
Const bldg = 1, bldg2 = 2, bldg3 = 3
Type bldg
Field bldg
Field howto
End Type
For blgdtest.bldg = Each bldg
If blgdtest\bldg = pickedbldg
Graphics3D 1024,768
imgtest = LoadImage ("victory.jpg")
DrawImage imgtest,0,0
Flip
WaitKey
Goto beginworld
EndIf
Next
;======================;
; This is our main loop. ;
;======================;
.main2
While Not KeyHit(1)
If alive
If KeyDown(200) MoveEntity camera_pivot,0,0,0.09
If KeyDown(208) MoveEntity camera_pivot,0,0,-0.05
End If
If KeyDown(203) TurnEntity camera_pivot,0,2,0
If KeyDown(205)TurnEntity camera_pivot,0,-2,0
x#=EntityX(camera_pivot)
y#=EntityY(camera_pivot)
z#=EntityZ(camera_pivot)
;# 14 Press space to show/hide camera 2
If Not waitum
If KeyDown(57)
If camflip
HideEntity cam2
camflip = False
waitum = 12
Else
ShowEntity cam2
camflip = True
waitum = 12
End If
End If
End If
If waitum waitum = waitum -1
;#14 images
Select holding
Case 1
DrawImage imgLamp,700,450
Case 2
DrawImage imgJar,700,450
Case 3
DrawImage imgNacar,700,450
Case 4
DrawImage imgankh,700,450
End Select
UpdateWorld
RenderWorld
If KeyDown (2)
Text 10,10, "X = " + x#
Text 10,25, "Y = " + y#
Text 10,40, "Z = " + z#
EndIf
If Not alive
DrawImage endgame,0,0
If finaltimer < MilliSecs() Then Exit
End If
Flip
Wend
Props file:
;include file props.bb
;================
;a floor
cube_tile = LoadTexture("Floor.jpg")
floor1 = CreateCube()
ScaleEntity floor1,8,0.06,13
ScaleTexture cube_tile,.5,.5
EntityTexture floor1,cube_tile
EntityType floor1,CARPET
EntityRadius floor1,.4
PositionEntity floor1, 67,5,120
;fence time! :)
thefence = LoadMesh ("woodenfence.b3d")
PositionEntity thefence, 60,5.8,109
RotateEntity thefence, 0,-90,0
ScaleEntity thefence, 0.1,0.1,0.1
texfence = LoadTexture ("woodfence.bmp")
EntityTexture thefence,texfence
EntityType thefence,PROPS
EntityRadius thefence,1
;more fennces
;the other side
fence6 = CopyEntity(thefence)
PositionEntity fence6, 60,5.8,109
fence7 = CopyEntity(thefence)
PositionEntity fence7, 60,5.8,113
fence8 = CopyEntity(thefence)
PositionEntity fence8, 60,5.8,117
fence9 = CopyEntity(thefence)
PositionEntity fence9, 60,5.8,121
fence10 = CopyEntity(thefence)
PositionEntity fence10, 60,5.8,125
fence11= CopyEntity(thefence)
PositionEntity fence11, 60,5.8,129
fence12 = CopyEntity(thefence)
PositionEntity fence12, 60,5.8,107
RotateEntity fence12, 0,180,0
fence13 = CopyEntity(fence12)
PositionEntity fence13, 64,5.8,107
fence14 = CopyEntity(fence12)
PositionEntity fence14, 68.5,5.8,107
;few more fences
fence16 = CopyEntity(fence12)
PositionEntity fence16, 65,5.8,131
fence17 = CopyEntity(fence12)
PositionEntity fence17, 69,5.8,131
fence18 = CopyEntity(fence12)
PositionEntity fence18, 72.5,5.8,131
fence20 = CopyEntity(fence18)
PositionEntity fence20, 61.5,5.8,130
;final fences
fence21 = CopyEntity(fence18)
PositionEntity fence21, 73.5,5.8,130
RotateEntity fence21, 0,-90,0
fence22 = CopyEntity(fence18)
PositionEntity fence22, 73.5,5.8,126
RotateEntity fence22, 0,-90,0
fence23 = CopyEntity(fence18)
PositionEntity fence23, 73.5,5.8,122
RotateEntity fence23, 0,-90,0
fence24 = CopyEntity(fence18)
PositionEntity fence24, 73.5,5.8,118
RotateEntity fence24, 0,-90,0
fence25 = CopyEntity(fence18)
PositionEntity fence25, 73.5,5.8,114
RotateEntity fence25, 0,-90,0
fence26 = CopyEntity(fence18)
PositionEntity fence26, 73.5,5.8,110
RotateEntity fence26, 0,-90,0
fence27 = CopyEntity(fence26)
PositionEntity fence27, 73.5,5.8,106
fence28 = CopyEntity (fence18)
PositionEntity fence28, 71.8197,5.8,100.995
;fence29 = CopyEntity (fence18)
;PositionEntity fence29
;building time
blgdtest.bldg = New bldg
bldgtest = LoadMesh ("shop.3ds")
PositionEntity bldgtest, 65.5081,6.2,105.07
RotateEntity bldgtest,0,90,0
ScaleEntity bldgtest, 0.08,0.08,0.08
bldgtex = LoadTexture ("comedy.jpg")
EntityTexture bldgtest,bldgtex
EntityType bldgtest,PROPS
EntityRadius bldgtest,1.10
Hope this helps.
|