`*****************************************
`*****************************************
`***
`*** TITLE - Off-Road Template
`*** VERSION - 1.0.0b LAST UPDATED - 1.13.2005
`*** DEVELOPER - Jason Holm
`*** COPYRIGHT - Ingenious Student Labs
`*** DATE CREATED - 1.11.2005
`***
`*****
` *** START SYSTEM SETUP SECTION
` ***
sync on
sync rate 30
autocam off
hide mouse
randomize timer()
` ***
` *** STOP SYSTEM SETUP SECTION
` ***
` ***************************************
` ***
` *** START INTRO SECTION
` ***
` ******
` *** INTRO SECTION HEADER
` ***
`DECLARE VARIABLES
`SCREEN DISPLAY
cls 0
load bitmap "images/jeep.jpeg"
ink rgb(255,255,255),0
center text 320,200, "INTRO SCREEN Level One"
load bitmap "images/jeep.jpeg"
center text 320,240, "HIT ANY KEY TO BEGIN"
`LOAD SOUNDS
`SOUND EFFECTS
`SPECIAL EFFECTS
`REFRESH SCREEN
sync
` ***
` *** INTRO SECTION LOOP
` ***
do
`SCREEN DISPLAY
`CONTROL INPUT
if keystate( scancode() ) = 1 then goto OptionsSection
`REFRESH SCREEN
sync
loop
` ******
` ***
` *** END INTRO SECTION
` ***
` *****************************************
` ***
` *** START OPTIONS SECTION
` ***
` ******
` *** OPTIONS SECTION HEADER
` ***
OptionsSection:
`DECLARE VARIABLES
`SCREEN DISPLAY
cls 0
ink rgb(255,255,255),0
center text 320,180, "LEVEL ONE"
center text 320,220, "MOVE - ARROW KEYS"
center text 320,240, "QUIT - Q"
center text 320,280, "HIT ANY KEY TO BEGIN"
`LOAD SOUNDS
`SOUND EFFECTS
`SPECIAL EFFECTS
`REFRESH SCREEN
sync
` ***
` *** OPTIONS SECTION LOOP
` ***
do
if scancode() = 0 then exit
loop
do
`SCREEN DISPLAY
`CONTROL INPUT
if keystate( scancode() ) = 1 then goto MainSection
`REFRESH SCREEN
sync
loop
` ******
` ***
` *** END OPTIONS SECTION
` ***
` *****************************************
` ***
` *** START MAIN SECTION
` ***
` ******
` *** MAIN SECTION HEADER
` ***
MainSection:
`DECLARE VARIABLES
`Player Character
topSpeed# = 15 : `Maximum speed of player character vehicle
totalFuel = 100 : `Timer
dim soundHit(100,3)
`SCREEN DISPLAY
cls 0
backdrop on
`LOAD IMAGES
`OBJECT CREATION
LoadLevelMap() : ` Run function to create world map
LoadPlayerCharacter() : ` Run function to create player character
`LOAD MODELS
`SET LIGHTS
`SET CAMERA
`SOUND EFFECTS
`SPECIAL EFFECTS
`REFRESH SCREEN
sync
` ***
` *** MAIN SECTION LOOP
` ***
do
if scancode() = 0 then exit
loop
do
`SPECIAL EFFECTS
`OBJECT ORIENTATIONS
P1X# = object position X(1)
P1Y# = object position Y(1)
P1Z# = object position Z(1)
A1X = object angle X(1)
A1Y = object angle Y(1)
A1Z = object angle Z(1)
`LIVE SCREEN DISPLAY
ink rgb(255,255,255),0
set cursor 20,20
print "FUEL REMAINING: ";totalFuel
`CONTROL INPUT
`Acceleration
if Upkey()=1 : `If user presses UP
if mySpeed# < topSpeed# then inc mySpeed#,.5
if mySpeed# > topSpeed# then dec mySpeed#,.5
dec totalFuel,1
endif
if Downkey()=1 : `If user presses DOWN
if mySpeed# > 0 - topSpeed# then dec mySpeed#,.5
if mySpeed# < 0 - topSpeed# then inc mySpeed#,.5
dec totalFuel,1
endif
if Downkey()=0 : `If user releases DOWN
if Upkey()=0 : `If user releases UP & DOWN
if mySpeed# > 0 then dec mySpeed#,.5
if mySpeed# < 0 then inc mySpeed#,.5
endif
endif
`Turning
if Leftkey() = 1
if mySpeed# > 0
if myTurn# <= 5 then inc myTurn#,.25
if myTurn# = 6 then dec myTurn#,.25
A1Y = wrapvalue( A1Y - myTurn# )
else
if mySpeed# < 0
if myTurn# >= -5 then dec myTurn#,.25
if myTurn# = -6 then inc myTurn#,.25
A1Y = wrapvalue( A1Y - myTurn# )
endif
endif
else
if Rightkey()=1
if mySpeed# > 0
if myTurn# >= -5 then dec myTurn#,.25
if myTurn# = -6 then inc myTurn#,.25
A1Y = wrapvalue( A1Y - myTurn# )
else
if mySpeed# < 0
if myTurn# <= 5 then inc myTurn#,.25
if myTurn# = 6 then dec myTurn#,.25
A1Y = wrapvalue( A1Y - myTurn# )
endif
endif
else
if mySpeed# > 0 or mySpeed# < 0
if myTurn# > 0
dec myTurn#,.25
else
if myTurn# < 0 then inc myTurn#,.25
endif
A1Y = wrapvalue( A1Y - myTurn# )
endif
endif
endif
`Quit Game
if Inkey$() = "q" or totalFuel = -1
ClearWorld()
goto Mainsection2
endif
`TRANSFORM OBJECTS
`MOVE OBJECTS - PRE-COLLISION
`Player Character
Yrotate object 1,A1Y
move object 1,mySpeed#
`Ground Level Adjustment
moveP1X# = object position X(1)
moveP1Y# = get ground height(1,object position X(1),object position Z(1))
moveP1Z# = object position Z(1)
position object 1, moveP1X#,moveP1Y#,moveP1Z#
newP1X# = object position X(1)
newP1Y# = object position Y(1)
newP1Z# = object position Z(1)
`COLLISION
`Check Player Character
`Wall Collision
s# = 10
if get static collision hit(P1X#-s#,P1Y#-s#,P1Z#-s#, P1X#+s#,P1Y#+s#,P1Z#+s#, newP1X#-s#,newP1Y#-s#,newP1Z#-s#, newP1X#+s#,newP1Y#+s#,newP1Z#+s#) = 1
dec newP1X#, get static collision x()
dec newP1Y#, get static collision y()
dec newP1Z#, get static collision z()
position object 1,newP1X#,newP1Y#,newP1Z#
endif
`Pick-Ups
for n = 401 to 500
if object exist(n) = 1 and soundHit(n-401,1) = 0
if object collision(1,n) > 0
`Pickup Object
`Sounder
play sound n
soundHit(n-401,1) = 1
endif
endif
next n
`Set Post-Collision Object Orientation Values
`Player Character
P1X# = object position X(1)
P1Y# = object position Y(1)
P1Z# = object position Z(1)
A1X = object angle X(1)
A1Y = object angle Y(1)
A1Z = object angle Z(1)
`Terrain Tilt
ta#=wrapvalue(A1Y-45)
frontleftx#=newxvalue(P1X#,ta#,25) : frontleftz#=newzvalue(P1Z#,ta#,35)
ta#=wrapvalue(A1Y+45)
frontrightx#=newxvalue(P1X#,ta#,25) : frontrightz#=newzvalue(P1Z#,ta#,35)
ta#=wrapvalue(A1Y+225)
backleftx#=newxvalue(P1X#,ta#,25) : backleftz#=newzvalue(P1Z#,ta#,35)
ta#=wrapvalue(A1Y+135)
backrightx#=newxvalue(P1X#,ta#,25) : backrightz#=newzvalue(P1Z#,ta#,35)
frontlefth#=get ground height(1,frontleftx#,frontleftz#)
frontrighth#=get ground height(1,frontrightx#,frontrightz#)
backlefth#=get ground height(1,backleftx#,backleftz#)
backrighth#=get ground height(1,backrightx#,backrightz#)
across#=((frontrighth#-frontlefth#)+(backrighth#-backlefth#))/2.0
length#=((backlefth#-frontlefth#)+(backrighth#-frontrighth#))/2.0
P1Y# = get ground height(1,object position X(1),object position Z(1))
trackh# = (frontlefth#+frontrighth#+backlefth#+backrighth#)/4.0
if trackh#>P1Y# then P1Y#=trackh#
position object 1, P1X#,P1Y#,P1Z#
rotate limb 1,1,wrapvalue(length#/4.0),0,wrapvalue(across#/4.0)
`Sound Timer
for n = 0 to 99
if soundHit(n,1) = 1
soundHit(n,3) = soundHit(n,3) + 1
if soundHit(n,3) = soundHit(n,2)
soundHit(n,1) = 0
soundHit(n,3) = 0
delete object n + 401 : `Option to delete object after sound plays
endif
endif
next n
`MOVE CAMERA
set camera to follow P1X#,P1Y#+20,P1Z#, A1Y,100,50, 20,1
`Sky Cylinder
position object 199,camera position x(),325,camera position z()
`MOVE LIGHT
`REFRESH SCREEN
sync
loop
MainSection2:
`DECLARE VARIABLES
`Player Character
topSpeed# = 20 : `Maximum speed of player character vehicle
totalFuel = 1000 : `Timer
dim soundHit(100,3)
`SCREEN DISPLAY
cls 0
backdrop on
`LOAD IMAGES
`OBJECT CREATION
LoadLevelMap() : ` Run function to create world map
LoadPlayerCharacter() : ` Run function to create player character
`LOAD MODELS
`SET LIGHTS
`SET CAMERA
`SOUND EFFECTS
`SPECIAL EFFECTS
`REFRESH SCREEN
sync
` ***
` *** MAIN SECTION LOOP
` ***
do
if scancode() = 0 then exit
loop
do
`SPECIAL EFFECTS
`OBJECT ORIENTATIONS
P1X# = object position X(1)
P1Y# = object position Y(1)
P1Z# = object position Z(1)
A1X = object angle X(1)
A1Y = object angle Y(1)
A1Z = object angle Z(1)
`LIVE SCREEN DISPLAY
ink rgb(255,255,255),0
set cursor 20,20
print "FUEL REMAINING: ";totalFuel
`CONTROL INPUT
`Acceleration
if Upkey()=1 : `If user presses UP
if mySpeed# < topSpeed# then inc mySpeed#,.5
if mySpeed# > topSpeed# then dec mySpeed#,.5
dec totalFuel,1
endif
if Downkey()=1 : `If user presses DOWN
if mySpeed# > 0 - topSpeed# then dec mySpeed#,.5
if mySpeed# < 0 - topSpeed# then inc mySpeed#,.5
dec totalFuel,1
endif
if Downkey()=0 : `If user releases DOWN
if Upkey()=0 : `If user releases UP & DOWN
if mySpeed# > 0 then dec mySpeed#,.5
if mySpeed# < 0 then inc mySpeed#,.5
endif
endif
`Turning
if Leftkey() = 1
if mySpeed# > 0
if myTurn# <= 5 then inc myTurn#,.25
if myTurn# = 6 then dec myTurn#,.25
A1Y = wrapvalue( A1Y - myTurn# )
else
if mySpeed# < 0
if myTurn# >= -5 then dec myTurn#,.25
if myTurn# = -6 then inc myTurn#,.25
A1Y = wrapvalue( A1Y - myTurn# )
endif
endif
else
if Rightkey()=1
if mySpeed# > 0
if myTurn# >= -5 then dec myTurn#,.25
if myTurn# = -6 then inc myTurn#,.25
A1Y = wrapvalue( A1Y - myTurn# )
else
if mySpeed# < 0
if myTurn# <= 5 then inc myTurn#,.25
if myTurn# = 6 then dec myTurn#,.25
A1Y = wrapvalue( A1Y - myTurn# )
endif
endif
else
if mySpeed# > 0 or mySpeed# < 0
if myTurn# > 0
dec myTurn#,.25
else
if myTurn# < 0 then inc myTurn#,.25
endif
A1Y = wrapvalue( A1Y - myTurn# )
endif
endif
endif
`Quit Game
if Inkey$() = "q" or totalFuel = -1
ClearWorld()
goto EndSection
endif
`TRANSFORM OBJECTS
`MOVE OBJECTS - PRE-COLLISION
`Player Character
Yrotate object 1,A1Y
move object 1,mySpeed#
`Ground Level Adjustment
moveP1X# = object position X(1)
moveP1Y# = get ground height(1,object position X(1),object position Z(1))
moveP1Z# = object position Z(1)
position object 1, moveP1X#,moveP1Y#,moveP1Z#
newP1X# = object position X(1)
newP1Y# = object position Y(1)
newP1Z# = object position Z(1)
`COLLISION
`Check Player Character
`Wall Collision
s# = 10
if get static collision hit(P1X#-s#,P1Y#-s#,P1Z#-s#, P1X#+s#,P1Y#+s#,P1Z#+s#, newP1X#-s#,newP1Y#-s#,newP1Z#-s#, newP1X#+s#,newP1Y#+s#,newP1Z#+s#) = 1
dec newP1X#, get static collision x()
dec newP1Y#, get static collision y()
dec newP1Z#, get static collision z()
position object 1,newP1X#,newP1Y#,newP1Z#
endif
`Pick-Ups
for n = 401 to 500
if object exist(n) = 1 and soundHit(n-401,1) = 0
if object collision(1,n) > 0
`Pickup Object
`Sounder
play sound n
soundHit(n-401,1) = 1
endif
endif
next n
`Set Post-Collision Object Orientation Values
`Player Character
P1X# = object position X(1)
P1Y# = object position Y(1)
P1Z# = object position Z(1)
A1X = object angle X(1)
A1Y = object angle Y(1)
A1Z = object angle Z(1)
`Terrain Tilt
ta#=wrapvalue(A1Y-45)
frontleftx#=newxvalue(P1X#,ta#,25) : frontleftz#=newzvalue(P1Z#,ta#,35)
ta#=wrapvalue(A1Y+45)
frontrightx#=newxvalue(P1X#,ta#,25) : frontrightz#=newzvalue(P1Z#,ta#,35)
ta#=wrapvalue(A1Y+225)
backleftx#=newxvalue(P1X#,ta#,25) : backleftz#=newzvalue(P1Z#,ta#,35)
ta#=wrapvalue(A1Y+135)
backrightx#=newxvalue(P1X#,ta#,25) : backrightz#=newzvalue(P1Z#,ta#,35)
frontlefth#=get ground height(1,frontleftx#,frontleftz#)
frontrighth#=get ground height(1,frontrightx#,frontrightz#)
backlefth#=get ground height(1,backleftx#,backleftz#)
backrighth#=get ground height(1,backrightx#,backrightz#)
across#=((frontrighth#-frontlefth#)+(backrighth#-backlefth#))/2.0
length#=((backlefth#-frontlefth#)+(backrighth#-frontrighth#))/2.0
P1Y# = get ground height(1,object position X(1),object position Z(1))
trackh# = (frontlefth#+frontrighth#+backlefth#+backrighth#)/4.0
if trackh#>P1Y# then P1Y#=trackh#
position object 1, P1X#,P1Y#,P1Z#
rotate limb 1,1,wrapvalue(length#/4.0),0,wrapvalue(across#/4.0)
`Sound Timer
for n = 0 to 99
if soundHit(n,1) = 1
soundHit(n,3) = soundHit(n,3) + 1
if soundHit(n,3) = soundHit(n,2)
soundHit(n,1) = 0
soundHit(n,3) = 0
delete object n + 401 : `Option to delete object after sound plays
endif
endif
next n
`MOVE CAMERA
set camera to follow P1X#,P1Y#+20,P1Z#, A1Y,100,50, 20,1
`Sky Cylinder
position object 199,camera position x(),325,camera position z()
`MOVE LIGHT
`REFRESH SCREEN
sync
loop
` ******
` ***
` *** STOP MAIN SECTION
` ***
` *****************************************
` ***
` *** START END SECTION
` ***
` ******
` *** END SECTION HEADER
` ***
EndSection:
`DECLARE VARIABLES
`SCREEN DISPLAY
cls 0
ink rgb(255,255,255),0
center text 320,200, "GAME OVER"
center text 320,240, "PLAY AGAIN [Y/N]?"
`SOUND EFFECTS
`SPECIAL EFFECTS
`REFRESH SCREEN
sync
` ***
` *** END SECTION LOOP
` ***
do
if scancode() = 0 then exit
loop
do
`CONTROL INPUT
if Inkey$() = "y" then goto Mainsection2
if Inkey$() = "n"
cls
end
endif
`REFRESH SCREEN
sync
loop
end
` ******
` ***
` *** STOP END SECTION
` ***
` *****************************************
` *****************************************
` ***
` *** START FUNCTIONS
` ***
` ******
` *** LOAD LEVEL MAP - LoadLevelMap
` *** Generates the 3D level
` ***
function LoadLevelMap()
`Obstacles
load image "images/racetrack.bmp",1
load image "images/rock.bmp",2
load image "images/grass.bmp",3
load image "images/sky.bmp",6
load image "images/tree.bmp",7
`Floor Matrix
make matrix 1,1600,1600,32,32
randomize matrix 1,20
prepare matrix texture 1,1,32,32
for tileX = 0 to 31
for tileZ = 0 to 31
set matrix tile 1,tileX,31 - tileZ,(tileX+1)+(32*tileZ)
next tileZ
next tileX
update matrix 1
`Sky Cylinder
make object cylinder 199,3000
scale object 199, 100,50,100
position object 199, 800,325,800
set object 199, 1,1,2,0,0
texture object 199,6
`Mountains
LoadObstacle(101, 600,300,100, 800,150,1550)
LoadObstacle(102, 600,300,100, 800,150,50)
LoadObstacle(103, 100,300,600, 50,150,800)
LoadObstacle(104, 100,300,600, 1550,150,800)
LoadObstacle(105, 500,300,500, 250,150,1350)
LoadObstacle(106, 500,300,500, 1350,150,1350)
LoadObstacle(107, 500,300,500, 250,150,250)
LoadObstacle(108, 500,300,500, 1350,150,250)
LoadObstacle(109, 200,300,200, 800,150,1200)
LoadObstacle(110, 200,300,200, 800,150,400)
LoadObstacle(111, 200,300,200, 400,150,800)
LoadObstacle(112, 200,300,200, 1200,150,800)
LoadObstacle(113, 200,300,200, 800,150,800)
LoadObstacle(114, 100,200,200, 450,100,600)
LoadObstacle(115, 150,150,150, 125,75,850)
`Trees & Shrubs
LoadScenery(116, 100,150,100, 100,50,1150, "tree")
LoadScenery(117, 100,150,100, 100,50,450, "tree")
LoadScenery(118, 100,150,100, 450,50,1500, "tree")
LoadScenery(119, 100,150,100, 450,50,100, "tree")
LoadScenery(120, 100,150,100, 1150,50,1500, "tree")
LoadScenery(121, 100,150,100, 1150,50,100, "tree")
LoadScenery(122, 100,150,100, 1500,50,1150, "tree")
LoadScenery(123, 100,150,100, 1500,50,450, "tree")
LoadScenery(124, 150,300,150, 0,50,1100, "tree")
LoadScenery(125, 150,300,150, 0,50,500, "tree")
LoadScenery(126, 150,300,150, 1600,50,1100, "tree")
LoadScenery(127, 150,300,150, 1600,50,500, "tree")
LoadScenery(128, 150,300,150, 500,50,1600, "tree")
LoadScenery(129, 150,300,150, 1100,50,1600, "tree")
LoadScenery(130, 150,300,150, 500,50,0, "tree")
LoadScenery(131, 150,300,150, 1100,50,0, "tree")
LoadScenery(132, 150,200,150, 375,20,500, "tree")
LoadScenery(133, 80,100,80, 450,50,700, "tree")
LoadScenery(134, 50,100,50, 325,50,875, "tree")
`Rocks
LoadScenery(135, 100,50,100, 450,10,1150, "rock")
LoadScenery(136, 100,50,100, 450,10,450, "rock")
LoadScenery(137, 100,50,100, 1150,10,1150, "rock")
LoadScenery(138, 100,50,100, 1150,10,450, "rock")
LoadScenery(139, 50,25,50, 375,10,1125, "rock")
LoadScenery(140, 50,150,50, 425,0,900, "rock")
LoadScenery(141, 40,25,40, 480,10,725, "rock")
`Hills
LoadScenery(142, 300,250,300, 0,50,1250, "hill")
LoadScenery(143, 300,250,300, 0,50,350, "hill")
LoadScenery(144, 300,250,300, 1600,50,1250, "hill")
LoadScenery(145, 300,250,300, 1600,50,350, "hill")
LoadScenery(146, 300,250,300, 350,50,1600, "hill")
LoadScenery(147, 300,250,300, 1250,50,1600, "hill")
LoadScenery(148, 300,250,300, 350,50,0, "hill")
LoadScenery(149, 300,250,300, 1250,50,0, "hill")
`Billboards
`(ObjNum, myXScale,myYScale,myZScale, myXPosition,myYPosition,myZPosition, myTexture$)
LoadSign(150, 200,100,2, 800,100,1100, "images/isl_sign.bmp") : `First Billboard
LoadSign(151, 10,160,10, 720,80,1106, "NONE")
LoadSign(152, 10,160,10, 880,80,1106, "NONE")
LoadSign(153, 200,100,2, 800,100,500, "images/carbonade_sign.bmp") : `First Billboard
LoadSign(154, 10,160,10, 720,80,494, "NONE")
LoadSign(155, 10,160,10, 880,80,494, "NONE")
`Grass
LoadGrass(156, 100,50, 400,25,1050, 95)
LoadGrass(157, 100,50, 400,25,950, 95)
LoadGrass(158, 100,50, 380,25,1050, 275)
LoadGrass(159, 100,50, 380,25,950, 275)
LoadGrass(160, 100,50, 750,25,1100, 5)
LoadGrass(161, 100,50, 850,25,1100, 5)
LoadGrass(162, 100,50, 750,25,500, 185)
LoadGrass(163, 100,50, 850,25,500, 185)
`Pick-Ups
`(ObjNum, XPos,YPos,ZPos, mySound$, myTexture$, soundTimer)
LoadLevelPickups(401, 200,20,600, "sounds/BONK.WAV", "images/cube_c.bmp", 10)
LoadLevelPickups(402, 550,20,600, "sounds/BEEP.WAV", "images/cube_b.bmp", 10)
LoadLevelPickups(403, 330,20,550, "sounds/BEEP.WAV", "images/cube_d.bmp", 10)
LoadLevelPickups(404, 900,20,600, "sounds/BEEP.WAV", "images/cube_a.bmp", 10)
LoadLevelPickups(405, 1100,20,300, "sounds/BEEP.WAV", "images/cube_e.bmp", 10)
`Environment
`Lights
`Fog
endfunction
` ***
` *** LOAD OBSTACLES - LoadObstacle
` *** Generates the solid static mountain elements of the 3D level
` ***
function LoadObstacle(ObjNum, myXScale,myYScale,myZScale, myXPosition,myYPosition,myZPosition)
make object cone ObjNum,100
scale object ObjNum, myXScale,myYScale,myZScale
color object ObjNum,rgb(255,0,0)
texture object ObjNum,2
scale object texture ObjNum,10,10
position object ObjNum, myXPosition,myYPosition,myZPosition
make static collision box myXPosition-(myXScale/2),myYPosition-(myYScale/2),myZPosition-(myZScale/2),myXPosition+(myXScale/2),myYPosition+(myYScale/2),myZPosition+(myZScale/2)
endfunction
` ***
` *** LOAD SCENERY - LoadScenery
` *** Generates hills, trees, rocks and other non-bounding objects
` ***
function LoadScenery(ObjNum, myXScale,myYScale,myZScale, myXPosition,myYPosition,myZPosition, myType$)
`Shape
if myType$ = "tree" or myType$ = "rock" then make object sphere ObjNum,100
if myType$ = "hill" then make object cone ObjNum,100
`Scale
scale object ObjNum, myXScale,myYScale,myZScale
`Texture
if myType$ = "tree"
texture object ObjNum,7
scale object texture ObjNum, 2,2
endif
if myType$ = "rock" or myType$ = "hill" then texture object ObjNum,2
`Position
position object ObjNum, myXPosition,myYPosition,myZPosition
endfunction
` ***
` *** LOAD SIGN - LoadSign
` *** Generates textured sign elements
` ***
function LoadSign(ObjNum, myXScale,myYScale,myZScale, myXPosition,myYPosition,myZPosition, myTexture$)
make object cube ObjNum,100
scale object ObjNum, myXScale,myYScale,myZScale
if myTexture$ = "NONE"
color object ObjNum, rgb(255,255,255)
else
load image myTexture$,ObjNum : `load sign texture
texture object ObjNum,ObjNum : `apply texture to sign
zrotate object ObjNum,180
endif
position object ObjNum, myXPosition,myYPosition,myZPosition
endfunction
` ***
` *** LOAD GRASS - LoadGrass
` *** Generates transparent grass objects
` ***
function LoadGrass(ObjNum, myXScale,myZScale, myXPosition,myYPosition,myZPosition, myYRotate)
make object plain ObjNum,myXScale,myZScale
position object ObjNum, myXPosition,myYPosition,myZPosition
Yrotate object ObjNum, myYRotate
set object ObjNum, 1,0,2
texture object ObjNum,3
endfunction
` ***
` *** LOAD PLAYER CHARACTER - LoadPlayerCharacter
` *** Generates the player vehicle
` ***
function LoadPlayerCharacter()
`Construction
`Vehicle
`Central Control Object
make object sphere 1,1
hide limb 1,0
`Tilting Object
make object sphere 2,1
make mesh from object 2,2
delete object 2
`Model Shell
load object "models/MILVEH14.X", 3
Yrotate object 3, 180
fix object pivot 3
scale object 3, 1100,1100,1100
`Light
`Assembly
add limb 1,1,2
hide limb 1,1
glue object to limb 3,1,1
make object collision box 1, -16,0,-33.5, 16,25,35.5, 1
`Positioning
`Vehicle
position object 1, 1000,20,600
yrotate object 1, 270
`Lights
`Camera
position camera 1100,70,600
point camera object position X(1),object position Y(1)+20,object position Z(1)
endfunction
` ***
` *** LOAD LEVEL PICK-UPS - LoadLevelPickups
` *** Generates the objects that can be collected or interacted with
` ***
function LoadLevelPickups(ObjNum, XPos,YPos,ZPos, mySound$, myTexture$, soundTimer)
make object cube ObjNum,30
zrotate object ObjNum,180
load image myTexture$,ObjNum
texture object ObjNum,ObjNum
make object collision box ObjNum, -25,-25,-25, 25,25,25, 0
position object ObjNum,XPos,YPos + get ground height(1,object position X(ObjNum),object position Z(ObjNum)),ZPos
load sound mySound$, ObjNum
soundHit(ObjNum-401,2) = soundTimer
endfunction
` ***
` *** CLEAR WORLD - ClearWorld
` *** Remove all existing 3D elements from world
` ***
function ClearWorld
for x = 1 to 1000
if object exist(x) = 1 then delete object x
if matrix exist(x) = 1 then delete matrix x
if mesh exist(x) = 1 then delete mesh x
if light exist(x) = 1 then delete light x
delete static objects
next x
fog off
backdrop off
endfunction
` ***
` *** STOP FUNCTIONS
`*****
`***
`*** END PROGRAM
`***
`*****************************************
`*****************************************
This is my code, could you help me find where I would need to alter the code?