I need to make three quick levels in this game, In my class I have to make the levels but I dont know how!! Please help me!! All I need to do is change some of the wall positions, textures and number of enemies.
`*****************************************
`*****************************************
`***
`*** TITLE - Flyer Prototype Template
`*** VERSION - 1.0.0b LAST UPDATED - 1.1.2005
`*** DEVELOPER - Jason Holm
`*** COPYRIGHT - Ingenious Student Labs
`*** DATE CREATED - 1.1.2005
`***
` ***
` *** START SYSTEM SETUP SECTION
` ***
sync on
sync rate 30
autocam on
hide mouse
randomize timer()
` ***
` *** STOP SYSTEM SETUP SECTION
` ***
` ***************************************
` ***
` *** START INTRO SECTION
` ***
` ***
` *** INTRO SECTION HEADER
` ***
`DECLARE VARIABLES
`SCREEN DISPLAY
cls 0
ink rgb(255,255,255),0
center text 320,220,"FLYER PROTOTYPE TEMPLATE"
center text 320,260,"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
`Levels
TotalLevels = 1 : `Total number of levels
LevelNumber = 1 : `Start on Level 1
`SCREEN DISPLAY
cls 0
ink rgb(255,255,255),0
center text 320,220, "PRESS SPACE BAR TO FIRE"
center text 320,260, "USE ARROW KEYS TO MOVE"
center text 320,280, "PRESS 'Q' TO QUIT"
center text 320,350, "PRESS ANY KEY TO CONTINUE"
`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 LevelIntroSection
`REFRESH SCREEN
sync
loop
` ***
` *** END OPTIONS SECTION
` ***
` *****************************************
` ***
` *** START LEVEL INTRO SECTION
` ***
` ***
` *** OPTIONS SECTION HEADER
` ***
LevelIntroSection:
`DECLARE VARIABLES
`SCREEN DISPLAY
cls 0
ink rgb(255,255,255),0
center text 320,220, "LEVEL"
set cursor 320,240
print LevelNumber
center text 320,260, "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 LEVEL INTRO SECTION
` ***
` *****************************************
` ***
` *** START MAIN SECTION
` ***
` ***
` *** MAIN SECTION HEADER
` ***
MainSection:
`DECLARE VARIABLES
`Player Character
`Projectiles
dim projectileReleased(23)
`LoadPlayerCharacter will create projectile objects 21-23 (0-20 are blank)
`projectileReleased(n) = 0 : Projectile waiting to be released
`projectileReleased(n) = 1 : Projectile traveling through the air
`projectileReleased(n) = 2 : Projectile currently exploding
dim projectileExplode(23)
SpacekeyHold = 0 : `Key release
`Enemies
dim LevelEnemies(0) = 0
dim LevelEnemiesDestroyed(0) = 0
thisLevelEnemies = 0
`Other
GameOver$ = ""
`LOAD IMAGES
`SCREEN DISPLAY
cls 0
backdrop on
`TEXT
`HEADS-UP DISPLAY (HUD)
`OBJECT CREATION
`World Map
LoadLevelMap()
`Player Character
LoadPlayerCharacter()
`Enemies
LoadLevelEnemies()
thisLevelEnemies = LevelEnemies(0)
`Declare New Variables
dim pXenemy#(thisLevelEnemies)
dim pYenemy#(thisLevelEnemies)
dim pZenemy#(thisLevelEnemies)
dim newpXenemy#(thisLevelEnemies)
dim newpYenemy#(thisLevelEnemies)
dim newpZenemy#(thisLevelEnemies)
`Pick-Ups
`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
`Player Character
1pX# = object position X(1)
1pY# = object position Y(1)
1pZ# = object position Z(1)
1aX = object angle X(1)
1aY = object angle Y(1)
1aZ = object angle Z(1)
`Enemies
for n = 301 to (300 + LevelEnemies(0))
if object exist(n) = 1
pXenemy#(n-300) = object position X(n)
pYenemy#(n-300) = object position Y(n)
pZenemy#(n-300) = object position Z(n)
endif
next n
`LIVE SCREEN DISPLAY
`TEXT
`HUD
`CONTROL INPUT
`Acceleration and Pitch
if Upkey()=1 then move object 1,10
if Downkey()=1 then move object 1,-10
`Turning and Banking
if Leftkey()=1 then 1aY = wrapvalue(1aY-5)
if Rightkey()=1 then 1aY = wrapvalue(1aY+5)
`Releasing Projectiles
if Spacekey()=1
if SpacekeyHold = 0
for n = 21 to 23 : `search for a projectile which is ready to be released
if projectileReleased(n) = 0
projectileReleased(n) = 1
show object n
exit
endif
next n
endif
SpacekeyHold = 1 : `key pressed
else
SpacekeyHold = 0 : `key released
endif
`Quit Game
if Inkey$() = "q"
GameOver$ = "quit"
ClearWorld()
goto EndSection
endif
`TRANSFORM OBJECTS
`MOVE OBJECTS - PRE-COLLISION
`Player Character
Yrotate object 1,1aY : `rotate object accordingly
new1pX# = object position X(1)
new1pY# = object position Y(1)
new1pZ# = object position Z(1)
`Projectiles
for n = 21 to 23
if projectileReleased(n) = 1 then move object n,20 : `move the projectile if it's been released
next n
`Enemies
MoveLevelEnemies()
`CHECK COLLISION
`Check Player Character
`Wall Collision
s# = 12.0
if get static collision hit(1pX#-s#,1pY#-s#,1pZ#-s#, 1pX#+s#,1pY#+s#,1pZ#+s#, new1pX#-s#,new1pY#-s#,new1pZ#-s#, new1pX#+s#,new1pY#+s#,new1pZ#+s#) = 1
dec new1pX#, get static collision x()
dec new1pY#, get static collision y()
dec new1pZ#, get static collision z()
position object 1,new1pX#,new1pY#,new1pZ# : rem adjust my position according to collision
endif
`Pick-Ups
`Check Projectile
for p = 21 to 23 : `Check all projectiles
if projectileReleased(p) > 0
`If this projectile has been released or is exploding
`Wall Collision
for n = 101 to 200 : `Check all walls
if object exist(n) = 1 : `If wall exists
if object collision(p,n) > 0 : `If projectile hits this wall
projectileReleased(p) = 2 : `Start projectile explosion
endif
endif
next n : `Check next wall
`Enemy Collision
for n = 301 to (300 + LevelEnemies(0)) : `Check all enemy objects on this level
if object exist(n) = 1 : `If enemy is still alive
if object collision(p,n) > 0 : `If projectile hits this enemy
projectileReleased(p) = 2 : `Start projectile explosion
delete object n : `Remove enemy object
LevelEnemiesDestroyed(0) = LevelEnemiesDestroyed(0) + 1 : `Mark up one more destroyed enemy
if LevelEnemiesDestroyed(0) = LevelEnemies(0) : `If all the enemies on this level are destroyed
GameOver$ = "win"
ClearWorld() : `Clear game world
goto EndSection : `Go to end screen
endif
endif
endif
next n
endif
if projectileReleased(p) = 2 then projectileCollide(p) : `If projectile is exploding, continue explosion
next p
`Check Enemy
s# = 25.0
for n = 1 to LevelEnemies(0)
if object exist(n+300) = 1
x1=pXenemy#(n) : `Abbreviated variable name to save space on lines below
y1=pYenemy#(n)
z1=pZenemy#(n)
x2=newpXenemy#(n)
y2=newpYenemy#(n)
z2=newpZenemy#(n)
if get static collision hit(x1-s#,y1-s#,z1-s#,x1+s#,y1+s#,z1+s#,x2-s#,y2-s#,z2-s#,x2+s#,y2+s#,z2+s#)=1
newpXenemy#(n) = newpXenemy#(n) - get static collision x()
newpYenemy#(n) = newpYenemy#(n) - get static collision y()
newpZenemy#(n) = newpZenemy#(n) - get static collision z()
position object n+300,newpXenemy#(n),newpYenemy#(n),newpZenemy#(n) : rem adjust my position according to collision
endif
endif
next n
`Set Post-Collision Object Orientation Values
`Player Character
1pX# = object position X(1)
1pY# = object position Y(1)
1pZ# = object position Z(1)
1aX = object angle X(1)
1aY = object angle Y(1)
1aZ = object angle Z(1)
`Projectile
for n = 21 to 23
if projectileReleased(n) = 0
position object n, 1pX#,1pY#,1pZ#
rotate object n, 1aX,1aY,1aZ
color object n, rgb(250,200,200)
endif
next n
`Check Player Expiration
`MOVE CAMERA
set camera to follow 1pX#,1pY#,1pZ#, 1aY,50,70, 1,1
`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
if GameOver$ = "quit" then center text 320,220, "GAME OVER"
if GameOver$ = "win" then center text 320,220, "YOU WIN!"
center text 320,260, "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 OptionsSection
if Inkey$() = "n"
cls 0
end
endif
`REFRESH SCREEN
sync
loop
end
` ***
` *** STOP END SECTION
` ***
` *****************************************
` *****************************************
` ***
` *** START FUNCTIONS
` ***
` ***
` *** LOAD LEVEL MAP - LoadLevelMap
` *** Generates the 3D level
` ***
function LoadLevelMap()
`Walls
LoadObstacle(101, 600,1200,100, 800,0,1550, "wall") : `North Wall
LoadObstacle(102, 600,1200,100, 800,0,50, "wall") : `South Wall
LoadObstacle(103, 100,1200,600, 50,0,800, "wall") : `West Wall
LoadObstacle(104, 100,1200,600, 1550,0,800, "wall") : `East Wall
`Corners
LoadObstacle(105, 500,1200,500, 250,0,1350, "corner") : `Northwest Corner
LoadObstacle(106, 500,1200,500, 1350,0,1350, "corner") : `Northeast Corner
LoadObstacle(107, 500,1200,500, 250,0,250, "corner") : `Southwest Corner
LoadObstacle(108, 500,1200,500, 1350,0,250, "corner") : `Southeast Corner
`Pillars
LoadObstacle(109, 200,600,200, 800,0,1200, "pillar") : `North Pillar
LoadObstacle(110, 200,600,200, 800,0,400, "pillar") : `South Pillar
LoadObstacle(111, 200,600,200, 400,0,800, "pillar") : `West Pillar
LoadObstacle(112, 200,600,200, 1200,0,800, "pillar") : `East Pillar
LoadObstacle(113, 200,600,200, 800,0,800, "pillar") : `Center Pillar
`Floor
LoadObstacle(100, 1600,1,1600, 800,0,800, "floor") : `Floor
endfunction
` ***
` *** LOAD OBSTACLES - LoadObstacle
` *** Generates the solid static wall/pillar elements of the 3D level
` ***
function LoadObstacle(myObject, myXScale,myYScale,myZScale, myXPosition,myYPosition,myZPosition, myType$)
make object cube myObject,100
scale object myObject, myXScale,myYScale,myZScale
make object collision box myObject, 0-(myXScale/2),0,0-(myZScale/2), (myXScale/2),myYScale,(myZScale/2), 0
position object myObject, myXPosition,myYPosition,myZPosition
make static collision box myXPosition-(myXScale/2),myYPosition,myZPosition-(myZScale/2),myXPosition+(myXScale/2),myYPosition+myYScale,myZPosition+(myZScale/2)
endfunction
` ***
` *** LOAD PLAYER CHARACTER - LoadPlayerCharacter
` *** Generates the player character ship and weapons
` ***
function LoadPlayerCharacter()
`Construction
`Ship
`Central Control Object
make object sphere 1,1 : `create the central control object
`Hull
make object cylinder 2,24 : `make a cone
scale object 2, 100,100,50 : `squash the cone front to back
xrotate object 2,90 : `turn cone on it's front
make mesh from object 2,2 : `make a mesh object from the cone
`Assembly
add limb 1,1,2 : `add a limb to object 1 (controller), call it limb 1, and use mesh 2 (cone) for the limb
color object 1,rgb(255,0,0)
make object collision box 1, -12,-12,-12, 12,12,12, 1 : `the collision box extends past the controller
`Projectiles
for n = 21 to 23 : `3 projectiles
make object sphere n,10
set object n, 1,1,1,2,0,1,0
color object n, rgb(255,150,150)
make object collision box n, -2,-2,-2, 2,2,2, 0
hide object n
next n
`Positioning
`Ship
position object 1, 1000,50,600 : `move player to selected starting spot in maze
yrotate object 1, 270 : `rotate player to face west
`Projectiles
for n = 21 to 23 : `3 projectiles
position object n, object position X(1),object position y(1),object position z(1)
set object to object orientation n,1
color object n, rgb(255,150,150)
projectileReleased(n) = 0
next n
`Camera
position camera 1100,70,600
point camera object position X(1),object position Y(1),object position Z(1) : rem point camera at player character
endfunction
` ***
` *** PROJECTILE COLLIDE - projectileCollide
` *** Projectile collision explosion animation
` ***
function projectileCollide(p)
if projectileExplode(p-20) = 0
color object p,rgb(255,150,200)
ghost object on p
endif
projectileExplode(p-20) = projectileExplode(p-20) + 1
if projectileExplode(p-20) <= 3
scale object p, 100 + (projectileExplode(p-20) * 200),100 + (projectileExplode(p-20) * 200),100 + (projectileExplode(p-20) * 200)
endif
if projectileExplode(p-20) > 3
scale object p, 700 - ((projectileExplode(p-20)-2) * 200),700 - ((projectileExplode(p-20)-2) * 200),700 - ((projectileExplode(p-20)-2) * 200)
endif
if projectileExplode(p-20) = 6
scale object p, 100,100,100
color object p,rgb(0,255,0)
ghost object off p
hide object p
projectileReleased(p) = 0
projectileExplode(p-20) = 0
endif
endfunction
` ***
` *** LOAD LEVEL ENEMIES - LoadLevelEnemies
` *** Generates the enemies
` ***
function LoadLevelEnemies()
LoadSpinner(301, 1000,50,1400) : `(ObjNum, XPos,YPos,ZPos)
LoadSpinner(302, 600,50,1000) : `(ObjNum, XPos,YPos,ZPos)
for x = 301 to 400
if object exist(x) = 1 then LevelEnemies(0) = LevelEnemies(0) + 1
`count how many enemies are on this level
next x
endfunction
` ***
` *** LOAD SPINNER - LoadSpinner
` *** Generates a simple spinning enemy
` ***
function LoadSpinner(ObjNum, XPos,YPos,ZPos)
make object cube ObjNum,50
color object ObjNum,rgb(255,212,0)
make object collision box ObjNum, -25,-25,-25, 25,25,25, 0
rotate object ObjNum, 45,0,45
fix object pivot ObjNum
position object ObjNum,XPos,YPos,ZPos
endfunction
` ***
` *** MOVE LEVEL ENEMIES - MoveLevelEnemies
` *** Moves the enemies
` ***
function MoveLevelEnemies()
for n = 301 to 400
if object exist(n) = 1
Yrotate object n, wrapvalue(object angle Y(n)+20)
n2 = rnd(1)
if n2 = 1 then move object n,10
endif
next n
for n = 301 to (300 + LevelEnemies(0))
if object exist(n) = 1
newpXenemy#(n-300) = object position X(n)
newpYenemy#(n-300) = object position Y(n)
newpZenemy#(n-300) = object position Z(n)
endif
next n
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
if x <= 32
if animation exist(x) = 1 then delete animation x
endif
next x
`Static Objects
make object cube 1,5
make static object 1
delete object 1
delete static objects
fog off
backdrop off
cls 0
endfunction
` ***
` *** STOP FUNCTIONS
` ***
`***
`*** END PROGRAM
`***
`*****************************************
`*****************************************