Ah, oh well, maybe next time
and i had an entrance and exit... not a physical exit but an exit by pressing the ctrl button, and i made it so you could go to the next level.
[edit] Ah! crap! i thought i had a different version loaded.
dim level(99)
for a=1 to 99
level(a)=rnd(100)
next a
zombie=1
vampire=2
darkcube=3
gorrilla=4
gosub textures
`=======================
global updown as boolean
global camangle#
global wallnum
global current_level
global platesize
global press as boolean
global leveltype
global fov as float
global falling as boolean
global swtichup as boolean
global switchdown as boolean
updown2 as boolean
platesize=60
wallnum=40
camangle#=0
enemynum=0
`=======================
type vector x as integer z as integer endtype
`=======================
type corridor position as vector cave as boolean turn as integer direction as integer collision as boolean endtype
type wall position as vector width as integer depth as integer endtype
type enemy health as integer attack as integer kind as integer vertspeed as integer speed as integer currentsegment as integer endtype
type player health as integer attack as integer gold as integer vertspeed as integer currentsegment as integer endtype
`=======================
type weapon name as string attack as integer color as dword size as integer equipped as boolean recip as boolean endtype
`=======================
dim wall(0) as wall
dim enemy(0) as enemy
dim player(1) as player
`=======================
`=======================
dim segment(0) as corridor
sync on
sync rate 100
`=======================
tex("initializing",rgb(255,255,255))
gosub init
cls
`=======================
cls
goto Maingame
Maingame:
leveltype=1
current_level=0
switchup=1
autocam off
do
gosub handlemovement
gosub handlemouse
ink rgb(255,255,255),rgb(255,255,255)
text 100,100,str$(falling)
text 1,1,"To move back a level, simply press CTRL"
if controlkey()=1 then switchdown=1
if switchdown=1 and current_level=1
switchdown=0
endif
position light 1, camera position x(0), camera position y(0)+20, camera position z(0)
if switchup=1 or switchdown=1
deletelevel(1)
if switchup=1
inc current_level
endif
if switchdown=1
dec current_level
endif
switchup=0
switchdown=0
if current_level=1
randomize level(current_level)
wallnum=60
color backdrop rgb(100,100,100)
platesize=60
makerandomcorridor(wallnum,10,4,5)
maptype=2
position object 1,500,5,10
endif
if current_level=2
randomize level(current_level)
wallnum=100
color backdrop rgb(255,255,255)
makerandomplains(1000,1000,wallnum)
maptype=1
position object 1,10,5,10
endif
if current_level=3
randomize level(current_level)
color backdrop rgb(0,0,0)
wallnum=40
makerandomcave(1000,1000,wallnum)
maptype=1
position object 1,10,5,10
endif
if current_level=4
randomize level(current_level)
wallnum=40
color backdrop rgb(0,0,0)
platesize=100
makerandomcorridor(wallnum,10,4,11)
maptype=2
position object 1,500,5,10
endif
if current_level=5
randomize level(current_level)
wallnum=40
color backdrop rgb(0,0,0)
platesize=60
makerandomcorridor2(wallnum,10,4)
maptype=3
fog on
fog distance 200
for a=1 to 100
make object sphere a+wallnum+1,rnd(100)
ghost object on a+wallnum+1
color object a+wallnum+1,rgb(rnd(255),rnd(255),rnd(255))
position object a+wallnum+1,rnd(4000)-2000,rnd(4000)-2000,rnd(4000)-2000
set object fog a+wallnum+1,0
next a
position object 1,0,5,10
endif
endif
if maptype=3
inc afg#
afg#=wrapvalue(afg#)
pos#=newxvalue(pos#,afg#,1)
set camera fov 0,pos#/5+90
endif
tex(str$(object position x(1)),rgb(0,0,0))
set camera to follow object position x(1),object position y(1), object position z(1),wrapvalue(object angle y(1))+camangle,30,20,10,0
sync
loop
`===========================================================================================================================
`===========================================================================================================================
`===========================================================================================================================
`===========================================================================================================================
`===========================================_________=========__________====================================================
`===============================================#==#============#==#========================================================
`==============================================#=<>=#==========#=<>=#=======================================================
`===============================================#==#============#==#========================================================
`================================================##==============##=========================================================
`===========================================================================================================================
`===========================================================================================================================
`===========================================================================================================================
`===========================================================================================================================
`===========================================================================================================================
`===========================================================================================================================
`==============================================0======@@@==@@@====0=========================================================
`==============================================0000000@@@00@@@00000=========================================================
`===============================================0000##@@@##@@@##000=========================================================
`=================================================0000000000000000==========================================================
`======================================================00000================================================================
`===========================================================================================================================
`===========================================================================================================================
`===========================================================================================================================
`===========================================================================================================================
`===========================================================================================================================
`===========================================================================================================================
`===========================================================================================================================
`bored
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--TEXTURES--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
textures:
tex("Creating texture 1",rgb(100,0,0))
gosub vampire
cls
tex("Creating texture 2",rgb(110,0,0))
gosub vampireattack
cls
tex("Creating texture 3",rgb(120,0,0))
gosub smiley
cls
tex("Creating texture 4",rgb(130,0,0))
gosub grass
cls
tex("Creating texture 5",rgb(140,0,0))
gosub cement
cls
tex("Creating texture 6",rgb(150,0,0))
gosub boulder
cls
tex("Creating texture 7",rgb(160,0,0))
gosub wall
cls
tex("Creating texture 8",rgb(170,0,0))
gosub zombie
cls
tex("Creating texture 9",rgb(180,0,0))
gosub zombieattack
cls
tex("Creating texture 10",rgb(190,0,0))
gosub barrier
gosub circles
cls
return
vampire:
cls rgb(100,100,100)
ink rgb(255,255,255),rgb(255,255,255)
circle 10,10,2
circle 30,10,2
line 10,30,30,30
ink rgb(0,255,0),rgb(0,255,0)
box 9,9,12,12
box 29,9,32,12
ink rgb(255,0,0),rgb(255,0,0)
line 12,30,13,34
line 13,34,14,30
line 26,30,27,34
line 27,34,28,30
ink rgb(0,0,0),rgb(0,0,0)
dot 10,10
dot 30,10
get image 1,1,1,40,40
return
vampireattack:
cls rgb(100,100,100)
ink rgb(255,255,255),rgb(255,255,255)
circle 10,10,2
circle 30,10,2
ink rgb(0,255,0),rgb(0,255,0)
box 9,9,12,12
box 29,9,32,12
ink rgb(0,0,0),rgb(0,0,0)
dot 10,10
dot 30,10
box 10,30,30,36
ink rgb(255,0,0),rgb(255,0,0)
line 12,30,13,34
line 13,34,14,30
line 26,30,27,34
line 27,34,28,30
get image 2,1,1,40,40
return
smiley:
cls rgb(230,230,0)
circle 10,10,2
circle 30,10,2
line 13,30,27,30
line 13,30,13,25
line 27,30,27,25
get image 3,1,1,40,40
return
grass:
for x=1 to 40
for y=1 to 40
dot x,y,rgb(0,rnd(30)+100,0)
next y
next x
get image 4,1,1,40,40
return
cement:
for x=1 to 40
for y=1 to 40
q=rnd(30)+100
dot x,y,rgb(q,q,q)
next y
next x
ink rgb(255,255,255),rgb(255,255,255)
get image 5,1,1,40,40
return
boulder:
cls rgb(255,255,255)
for x=0 to 40
for y=0 to 40
q=rnd(30)+100
dot x,y,rgb(q,q/2,q/2)
next y
next x
ink rgb(255,255,255),rgb(255,255,255)
for a=1 to 2
custombox(rnd(30),rnd(60),rnd(5)+5,rnd(40))
next a
for a=1 to 2
custombox(rnd(60),rnd(30),rnd(40),rnd(5)+5)
next a
for a=1 to 2
custombox(rnd(30),rnd(60),rnd(5)+30,rnd(40))
next a
for a=1 to 2
custombox(rnd(60),rnd(30),rnd(40),rnd(5)+30)
next a
get image 6,1,1,40,40
return
wall:
for x=0 to 100
for y=0 to 100
q=rnd(30)+50
dot x,y,rgb(q,q/2,q/2)
next y
next x
for a=1 to 7
paste image 6, rnd(60),rnd(60)
next a
get image 7,1,1,100,100
return
barrier:
for x=0 to 100
for y=0 to 40
q=rnd(30)+50
dot x,y,rgb(q,q/2,q/2)
next y
next x
for a=1 to 7
paste image 6, rnd(60),rnd(60)
next a
get image 10,1,1,40,40
get image 11,1,1,100,40
return
zombie:
cls rgb(0,30,0)
blur bitmap 0,3
ink rgb(0,0,0),rgb(0,0,0)
ellipse 10,10,4,4
ellipse 30,10,4,4
ellipse 10,10,3,3
ellipse 30,10,3,3
ellipse 10,10,2,2
ellipse 30,10,2,2
ellipse 10,10,1,1
ellipse 30,10,1,1
line 10,30,30,30
box 10,30,23,32
ink rgb(255,0,0),rgb(255,0,0)
line 10,0,13,4
line 13,4,8,12
line 12,30,13,34
line 13,34,14,30
get image 8,1,1,40,40
return
zombieattack:
cls rgb(0,30,0)
blur bitmap 0,3
ink rgb(0,0,0),rgb(0,0,0)
ellipse 10,10,4,3
ellipse 30,10,4,3
ellipse 10,10,3,2
ellipse 30,10,3,2
ellipse 10,10,2,1
ellipse 30,10,2,1
ellipse 10,10,1,1
ellipse 30,10,1,1
line 10,30,30,30
box 10,30,30,35
ink rgb(255,0,0),rgb(255,0,0)
line 10,0,13,4
line 13,4,8,12
line 12,30,13,34
line 13,34,14,30
line 20,35,21,32
line 21,32,22,35
get image 9,1,1,40,40
return
circles:
create bitmap 1,400,400
set current bitmap 1
cls rgb(255,255,255)
for a=1 to 400
afh=rnd(5)
if afh<=2
ink rgb(0,0,rnd(50)+200),rgb(0,0,rnd(50)+200)
endif
if afh>2 and afh<=4
l=rnd(50)+200
ink rgb(l/1.5,l/1.5,l),rgb(l/1.5,l/1.5,l)
endif
if afh=5
ink rgb(rnd(50)+200,0,0),rgb(rnd(50)+200,0,0)
endif
circle 200,200,a
next a
blur bitmap 1,6
get image 12,1,1,400,400
delete bitmap 1
set current bitmap 0
return
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--Player Control Functions--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
handlemovement:
`setup variables
x1#=object position x(1)
z1#=object position z(1)
`gets the angle of the object
a#=wrapvalue(object angle y(1))
`moving forwards
if upkey()=1
x#=newxvalue(object position x(1),a#,1)
z#=newzvalue(object position z(1),a#,1)
endif
`moving backwards
if downkey()=1
x#=newxvalue(object position x(1),a#,-1)
z#=newzvalue(object position z(1),a#,-1)
endif
`turning right
if rightkey()=1 then rotate object 1,object angle x(1), object angle y(1)+1, object angle z(1)
`left
if leftkey()=1 then rotate object 1,object angle x(1), object angle y(1)-1, object angle z(1)
`This bit of code checks for collision with the walls using just the X and Z dimensions. Works only on the Plains map
`and the Cavern map.
d=1
if maptype=1
`does this for every wall there is
for c=1 to wallnum-6
`checks for a collision
if object position x(d)>wall(c).position.x-wall(c).width/2
if object position x(d)<wall(c).position.x+wall(c).width/2
if object position z(d)>wall(c).position.z-wall(c).width/2
if object position z(d)<wall(c).position.z+wall(c).width/2
intersect=1
endif
endif
endif
endif
`If there's a collision, then it goes through all possible collisions
if intersect=1
if object position x(d)<wall(c).position.x+wall(c).width/2
if object position x(d)>wall(c).position.x-wall(c).width/2
if object position z(d)>wall(c).position.z-wall(c).depth/2
if object position z(d)<wall(c).position.z-wall(c).depth/2+1.1
z#=wall(c).position.z-wall(c).depth/2
endif
endif
endif
endif
if object position x(d)<wall(c).position.x+wall(c).width/2
if object position x(d)>wall(c).position.x-wall(c).width/2
if object position z(d)>wall(c).position.z+wall(c).depth/2-1.1
if object position z(d)<wall(c).position.z+wall(c).depth/2
z#=wall(c).position.z+wall(c).depth/2
endif
endif
endif
endif
if object position z(d)<wall(c).position.z+wall(c).depth/2
if object position z(d)>wall(c).position.z-wall(c).depth/2
if object position x(d)>wall(c).position.x+wall(c).width/2-1.1
if object position x(d)<wall(c).position.x+wall(c).width/2
x#=wall(c).position.x+wall(c).width/2
endif
endif
endif
endif
if object position z(d)<wall(c).position.z+wall(c).depth/2
if object position z(d)>wall(c).position.z-wall(c).depth/2
if object position x(d)>wall(c).position.x-wall(c).width/2
if object position x(d)<wall(c).position.x-wall(c).width/2+1.1
x#=wall(c).position.x-wall(c).width/2
endif
endif
endif
endif
endif
if object position x(d)>900
if object position z(d)>900
switchup=1
endif
endif
if object position x(1)<0 then x#=0
if object position x(1)>1000 then x#=1000
if object position z(1)<0 then z#=0
if object position z(1)>1000 then z#=1000
`AAAAnaaand done.
next c
endif
if maptype=2
left=1
up=3
right=2
down=4
`checks to see which segment the player is in
for b=1 to wallnum
if segment(b).cave=0
if object position x(d)=>segment(b).position.x-(platesize/2)
if object position x(d)=<segment(b).position.x+(platesize/2)
if object position z(d)=>segment(b).position.z-(platesize/2)
if object position z(d)=<segment(b).position.z+(platesize/2)
player(1).currentsegment=b
f=1
endif
endif
endif
endif
endif
next b
c=player(1).currentsegment
if c=wallnum then switchup=1
`checks to see if collision is on or off for the current segment
if segment(c).collision=0
`if it's on
`then check to see if it's a turn
if c>1
if segment(c).direction<>segment(c-1).direction
`if it's a up to left turn
if segment(c).direction=left
if segment(c-1).direction=up
`then ya can't go over the right or upper wall
if object position x(1)>segment(c).position.x+(platesize/2)
x#=segment(c).position.x+(platesize/2)
endif
if object position z(1)>segment(c).position.z+(platesize/2)
z#=segment(c).position.z+(platesize/2)
endif
endif
endif
`if it's a up to right turn
if segment(c).direction=right
if segment(c-1).direction=up
`then you can't go over the left or upper wall.
if object position x(1)<segment(c).position.x-(platesize/2)
x#=segment(c).position.x-(platesize/2)
endif
if object position z(1)>segment(c).position.z+(platesize/2)
z#=segment(c).position.z+(platesize/2)
endif
endif
endif
`if its a down to right turn
if segment(c).direction=right
if segment(c-1).direction=down
`then you can't go over the left or lower wall
if object position x(1)<segment(c).position.x-(platesize/2)
x#=segment(c).position.x-(platesize/2)
endif
if object position z(1)<segment(c).position.z-(platesize/2)
z#=segment(c).position.z-(platesize/2)
endif
endif
endif
`if it's a down to left turn
if segment(c).direction=left
if segment(c-1).direction=down
`then you can't go over the right or lower wall.
if object position x(1)>segment(c).position.x+(platesize/2)
x#=segment(c).position.x+(platesize/2)
endif
if object position z(1)<segment(c).position.z-(platesize/2)
z#=segment(c).position.z-(platesize/2)
endif
endif
endif
`if it's a left to up turn
if segment(c).direction=up
if segment(c-1).direction=left
`then you can't go over the left or lower wall.
if object position x(1)<segment(c).position.x-(platesize/2)
x#=segment(c).position.x-(platesize/2)
endif
if object position z(1)<segment(c).position.z-(platesize/2)
z#=segment(c).position.z-(platesize/2)
endif
endif
endif
`if it's a left to down turn
if segment(c).direction=down
if segment(c-1).direction=left
`then you can't go over the left or upper wall.
if object position x(1)<segment(c).position.x-(platesize/2)
x#=segment(c).position.x-(platesize/2)
endif
if object position z(1)>segment(c).position.z+(platesize/2)
z#=segment(c).position.z+(platesize/2)
endif
endif
endif
`if it's a right to up turn
if segment(c).direction=up
if segment(c-1).direction=right
`then you can't go over the right or lower wall.
if object position x(1)>segment(c).position.x+(platesize/2)
x#=segment(c).position.x+(platesize/2)
endif
if object position z(1)<segment(c).position.z-(platesize/2)
z#=segment(c).position.z-(platesize/2)
endif
endif
endif
`if it's a right to down turn
if segment(c).direction=left
if segment(c-1).direction=down
`then you can't go over the right or upper wall.
if object position x(1)>segment(c).position.x+(platesize/2)
x#=segment(c).position.x+(platesize/2)
endif
if object position z(1)<segment(c).position.z+(platesize/2)
z#=segment(c).position.z+(platesize/2)
endif
endif
endif
else
if segment(c).direction=up
if object position x(1)<segment(c).position.x-(platesize/2)
x#=segment(c).position.x-(platesize/2)
endif
if object position x(1)>segment(c).position.x+(platesize/2)
x#=segment(c).position.x+(platesize/2)
endif
endif
if segment(c).direction=down
if object position x(1)<segment(c).position.x-(platesize/2)
x#=segment(c).position.x-(platesize/2)
endif
if object position x(1)>segment(c).position.x+(platesize/2)
x#=segment(c).position.x+(platesize/2)
endif
endif
if segment(c).direction=right
if object position z(1)<segment(c).position.z-(platesize/2)
z#=segment(c).position.z-(platesize/2)
endif
if object position z(1)>segment(c).position.z+(platesize/2)
z#=segment(c).position.z+(platesize/2)
endif
endif
if segment(c).direction=left
if object position z(1)<segment(c).position.z-(platesize/2)
z#=segment(c).position.z-(platesize/2)
endif
if object position z(1)>segment(c).position.z+(platesize/2)
z#=segment(c).position.z+(platesize/2)
endif
endif
endif
endif
endif
endif
position object 1, x#,5,z#
if maptype=3
falling=0
tolerance=3
left=1
up=3
right=2
down=4
`checks to see which segment the player is in
for b=1 to wallnum
if segment(b).cave=0
if object position x(d)=>segment(b).position.x-(platesize/2)
if object position x(d)=<segment(b).position.x+(platesize/2)
if object position z(d)=>segment(b).position.z-(platesize/2)
if object position z(d)=<segment(b).position.z+(platesize/2)
player(1).currentsegment=b
endif
endif
endif
endif
endif
next b
c=player(1).currentsegment
`checks to see if collision is on or off for the current segment
if segment(c).collision=0
`if it's on
`then check to see if it's a turn
if c>1
if segment(c).direction<>segment(c-1).direction
`if it's a up to left turn
if segment(c).direction=left
if segment(c-1).direction=up
`then ya can't go over the right or upper wall
if object position x(1)>segment(c).position.x+(platesize/2)+tolerance
falling=1
endif
if object position z(1)>segment(c).position.z+(platesize/2)+tolerance
falling=1
endif
endif
endif
`if it's a up to right turn
if segment(c).direction=right
if segment(c-1).direction=up
`then you can't go over the left or upper wall.
if object position x(1)<segment(c).position.x-(platesize/2)-tolerance
falling=1
endif
if object position z(1)>segment(c).position.z+(platesize/2)+tolerance
falling=1
endif
endif
endif
`if its a down to right turn
if segment(c).direction=right
if segment(c-1).direction=down
`then you can't go over the left or lower wall
if object position x(1)<segment(c).position.x-(platesize/2)-tolerance
falling=1
endif
if object position z(1)<segment(c).position.z-(platesize/2)-tolerance
falling=1
endif
endif
endif
`if it's a down to left turn
if segment(c).direction=left
if segment(c-1).direction=down
`then you can't go over the right or lower wall.
if object position x(1)>segment(c).position.x+(platesize/2)+tolerance
falling=1
endif
if object position z(1)<segment(c).position.z-(platesize/2)-tolerance
falling=1
endif
endif
endif
`if it's a left to up turn
if segment(c).direction=up
if segment(c-1).direction=left
`then you can't go over the left or lower wall.
if object position x(1)<segment(c).position.x-(platesize/2)-tolerance
falling=1
endif
if object position z(1)<segment(c).position.z-(platesize/2)-tolerance
falling=1
endif
endif
endif
`if it's a left to down turn
if segment(c).direction=down
if segment(c-1).direction=left
`then you can't go over the left or upper wall.
if object position x(1)<segment(c).position.x-(platesize/2)-tolerance
falling=1
endif
if object position z(1)>segment(c).position.z+(platesize/2)+tolerance
falling=1
endif
endif
endif
`if it's a right to up turn
if segment(c).direction=up
if segment(c-1).direction=right
`then you can't go over the right or lower wall.
if object position x(1)>segment(c).position.x+(platesize/2)+tolerance
falling=1
endif
if object position z(1)<segment(c).position.z-(platesize/2)-tolerance
falling=1
endif
endif
endif
`if it's a right to down turn
if segment(c).direction=left
if segment(c-1).direction=down
`then you can't go over the right or upper wall.
if object position x(1)>segment(c).position.x+(platesize/2)+tolerance
falling=1
endif
if object position z(1)<segment(c).position.z+(platesize/2)+tolerance
falling=1
endif
endif
endif
else
if segment(c).direction=up
if object position x(1)<segment(c).position.x-(platesize/2)-tolerance
falling=1
endif
if object position x(1)>segment(c).position.x+(platesize/2)+tolerance
falling=1
endif
endif
if segment(c).direction=down
if object position x(1)<segment(c).position.x-(platesize/2)-tolerance
falling=1
endif
if object position x(1)>segment(c).position.x+(platesize/2)+tolerance
falling=1
endif
endif
if segment(c).direction=right
if object position z(1)<segment(c).position.z-(platesize/2)-tolerance
falling=1
endif
if object position z(1)>segment(c).position.z+(platesize/2)+tolerance
falling=1
endif
endif
if segment(c).direction=left
if object position z(1)<segment(c).position.z-(platesize/2)-tolerance
falling=1
endif
if object position z(1)>segment(c).position.z+(platesize/2)+tolerance
falling=1
endif
endif
endif
endif
endif
endif
position object 1, x#,5,z#
return
`This makes sure the player doesnt go out of the map. If you change the size of the map, you also need to change
`these variables.
`and now we place the object.
position object 1,x#,5,z#
return
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--Object Creation Functions--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`This is TDK's limb cube function. Im too lazy to make one of my own.
Function MakeLimbCube(ObjNum,Size#)
Offset#=Size#/2.0: MeshNum=2000: PlainNum=2000
Make Object Cube ObjNum,Size#
Make Object Plain PlainNum,Size#,Size#
Make Mesh From Object MeshNum,PlainNum
ADD LIMB ObjNum, 1, 2000: Offset Limb ObjNum,1,0,0,0.0-Offset#: Rem Cube Side 1 (Front)
ADD LIMB ObjNum, 2, 2000: Rotate Limb ObjNum,2,0,90,0: Offset Limb ObjNum,2,0.0-Offset#,0,0: Rem Cube Side 2 (Left)
ADD LIMB ObjNum, 3, 2000: Rotate Limb ObjNum,3,0,180,0: Offset Limb ObjNum,3,0,0,Offset#: Rem Cube Side 3 (Back)
ADD LIMB ObjNum, 4, 2000: Rotate Limb ObjNum,4,0,270,0: Offset Limb ObjNum,4,Offset#,0,0: Rem Cube Side 4 (Right)
ADD LIMB ObjNum, 5, 2000: Rotate Limb ObjNum,5,270,0,0: Offset Limb ObjNum,5,0,0.0-Offset#,0: Rem Cube Side 5 (Bottom)
ADD LIMB ObjNum, 6, 2000: Rotate Limb ObjNum,6,90,0,0: Offset Limb ObjNum,6,0,Offset#,0: Rem Cube Side 6 (Top)
Set Object Cull ObjNum,0
Delete Mesh MeshNum
Delete Object PlainNum
Hide Limb ObjNum,0
EndFunction
`This function changes the color of said Limb Cube.
function ColorCube(objnum as integer, color as dword)
for a=1 to 6
if a<>3
color limb objnum,a,color
endif
next a
endfunction
`function MakeRandomEnemies (width as integer, depth as integer, number as integer, type as integer
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--Level Creation Functions--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function makerandomcave(width as integer,depth as integer,wallnum as integer)
`creates the ground
make object plain 2,width,depth
rotate object 2,90,0,0
position object 2,width/2,0,depth/2
texture object 2, 7
`creates the cieling
make object plain 7,width,depth
rotate object 7,90,0,0
position object 7,width/2,50,depth/2
texture object 7, 7
`creates the left wall
make object plain 3,width,50
position object 3,width/2,25,0
`creates the front wall
make object plain 4,depth,50
rotate object 4,0,90,0
position object 4,0,25,depth/2
`creates the right wall
make object plain 5,width,50
position object 5,width/2,25,depth
`creates the back wall
make object plain 6,depth,50
position object 6,width,25,depth/2
rotate object 6,0,90,0
`Meh, too lazy to type texture object four times.
for a=1 to 4
b=a+2
texture object b, 11
next a
`wallnum-6 because of the six wall objects
abc=wallnum-6
for a=1 to abc
`Adds an entry into the Array.
array insert at bottom wall(0)
`positions it at a random position
x=rnd(width)
z=rnd(depth)
`These are interchangeable. The block needs to be rectangular, so the variable B chooses whether c= width and d=depth,
`or d=width and c=depth. I wrote the program so that if you want to change these values, then you just change these
`values. This is useful if you think the map is too open.
c=rnd(50)+50
d=rnd(25)+25
b=rnd(2)
`if c is width and d is depth
if b<=1
wall(a).width=c
wall(a).depth=d
`stores the randomly selected positions in the array
wall(a).position.x=x
wall(a).position.z=z
`makes sure that the object's furthest edges are inside the map.
if x-(c/2)<=0
wall(a).position.x=wall(a).position.x+(c/2)
endif
if x+(c/2)>=width
wall(a).position.x=wall(a).position.x-(c/2)
endif
if z-(d/2)<=0
wall(a).position.z=wall(a).position.z+(d/2)
endif
if z+(d/2)>=depth
wall(a).position.z=wall(a).position.z-(d/2)
endif
endif
`duzzit again but changing width and depth.
if b=2
wall(a).width=d
wall(a).depth=c
wall(a).position.x=x
wall(a).position.z=z
if x-(d/2)<=0
wall(a).position.x=wall(a).position.x+(d/2)
endif
if x+(d/2)>=width
wall(a).position.x=wall(a).position.x-(d/2)
endif
if z-(c/2)<=0
wall(a).position.z=wall(a).position.z+(c/2)
endif
if z+(c/2)>=depth
wall(a).position.z=wall(a).position.z-(c/2)
endif
endif
`Makes the objects. Object one is the player, and two through 7 are the walls.
make object box a+7,wall(a).width,50,wall(a).depth
`positions it so that the entire level has a positive x/z position
position object a+7,wall(a).position.x,25,wall(a).position.z
`Textures it.
texture object a+7,10
next a
make object cube wallnum+100,100
ghost object on wallnum+100
position object wallnum+100,950,50,950
color object wallnum+100, rgb(0,255,0)
endfunction
function makerandomplains(width as integer,depth as integer,wallnum as integer)
`creates the ground
make object plain 2,width,depth
rotate object 2,90,0,0
position object 2,width/2,0,depth/2
texture object 2, 4
`creates the left wall
make object plain 3,width,20
position object 3,width/2,10,0
`creates the front wall
make object plain 4,depth,20
rotate object 4,0,90,0
position object 4,0,10,depth/2
`creates the right wall
make object plain 5,width,20
position object 5,width/2,10,depth
`creates the back wall
make object plain 6,depth,20
position object 6,width,10,depth/2
rotate object 6,0,90,0
`Meh, too lazy to type texture object four times.
for a=1 to 4
b=a+2
texture object b, 4
next a
`wallnum-6 because of the six wall objects
abc=wallnum-6
for a=1 to abc
`Adds an entry into the Array.
array insert at bottom wall(0)
`positions it at a random position
x=rnd(width)
z=rnd(depth)
`These are interchangeable. The block needs to be rectangular, so the variable B chooses whether c= width and d=depth,
`or d=width and c=depth. I wrote the program so that if you want to change these values, then you just change these
`values. This is useful if you think the map is too open.
c=rnd(10)+10
d=c
b=rnd(2)
wall(a).width=c
wall(a).depth=c
wall(a).position.x=x
wall(a).position.z=z
if x-(d/2)<=0
wall(a).position.x=wall(a).position.x+(d/2)
endif
if x+(d/2)>=width
wall(a).position.x=wall(a).position.x-(d/2)
endif
if z-(c/2)<=0
wall(a).position.z=wall(a).position.z+(c/2)
endif
if z+(c/2)>=depth
wall(a).position.z=wall(a).position.z-(c/2)
endif
height=rnd(25)+50
size=c+d+height/3
make object cube 1000,size
make mesh from object 1,1000
`Makes the objects. Object one is the player, and two through 7 are the walls.
make object box a+7,wall(a).width,height,wall(a).depth
add limb a+7,1,1
offset limb a+7,1,0,height/2+(c/2)-2,0
`positions it so that the entire level has a positive x/z position
position object a+7,wall(a).position.x,height/2,wall(a).position.z
`Textures it.
texture object a+7,10
texture limb a+7,1,4
delete object 1000
delete mesh 1
next a
make object cube wallnum+80,100
ghost object on wallnum+80
color object wallnum+80, rgb(0,255,0)
position object wallnum+80,950,50,950
endfunction
function makerandomcorridor(segments as integer, maxturns as integer, turnnum as integer,texturenum as integer)
left=1
up=3
right=2
down=4
tempturn=0
tempcaves=0
for a=1 to segments
array insert at bottom segment(0)
if a=1
segment(a).position.x=500
segment(a).position.z=10
segment(a).direction=up
else
segment(a).direction=segment(a-1).direction
segment(a).turn=segment(a-1).direction
b=rnd(6)
`turn
if segment(a).direction=left
segment(a).position.x=segment(a-1).position.x-platesize
segment(a).position.z=segment(a-1).position.z
endif
if segment(a).direction=right
segment(a).position.x=segment(a-1).position.x+platesize
segment(a).position.z=segment(a-1).position.z
endif
if segment(a).direction=up
segment(a).position.x=segment(a-1).position.x
segment(a).position.z=segment(a-1).position.z+platesize
endif
if segment(a).direction=down
segment(a).position.x=segment(a-1).position.x
segment(a).position.z=segment(a-1).position.z-platesize
endif
if b=1
if tempturn<=maxturns
en=0
for j=1 to turnnum
if en=0
if a-j-1<=1
en=1
endif
if segment(a-j).direction<>segment(a-(j+1)).direction
en=1
endif
endif
next j
if en=0
c=rnd (2)
segment(a).turn=c
if segment(a-1).direction=left
if c=left then segment(a).direction=down
if c=right then segment(a).direction=up
endif
if segment(a-1).direction=right
if c=left then segment(a).direction=up
if c=right then segment(a).direction=down
endif
if segment(a-1).direction=up
if c=left then segment(a).direction=left
if c=right then segment(a).direction=right
endif
if segment(a-1).direction=down
if c=left then segment(a).direction=right
if c=right then segment(a).direction=left
endif
inc tempturn
endif
endif
endif
endif
next a
for f=1 to wallnum
for e=1 to wallnum
if f<>e
if segment(f).position.x=segment(e).position.x
if segment(f).position.z=segment(e).position.z
segment(f).collision=1
segment(e).collision=1
endif
endif
endif
next e
next f
make object box 1000,platesize,60,0.1
make mesh from object 1,1000
delete object 1000
make object box 1000,platesize,0.1,platesize
make mesh from object 2,1000
delete object 1000
for a=1 to segments
make object box a+1,platesize,0.1,platesize
position object a+1,segment(a).position.x,0,segment(a).position.z
add limb a+1,1,2
offset limb a+1,1,0,60,0
texture object a+1,texturenum
if a <>segmentnum
if segment(a).collision=0
if a<>1
if segment(a).direction=segment(a-1).direction
if segment(a).direction=left
add limb a+1,2,1
offset limb a+1,2,0,30,platesize/2
add limb a+1,3,1
offset limb a+1,3,0,30,-platesize/2
endif
if segment(a).direction=right
add limb a+1,2,1
offset limb a+1,2,0,30,platesize/2
add limb a+1,3,1
offset limb a+1,3,0,30,-platesize/2
endif
if segment(a).direction=up
add limb a+1,2,1
rotate limb a+1,2,0,90,0
offset limb a+1,2,platesize/2,30,0
add limb a+1,3,1
rotate limb a+1,3,0,90,0
offset limb a+1,3,-platesize/2,30,0
endif
if segment(a).direction=down
add limb a+1,2,1
rotate limb a+1,2,0,90,0
offset limb a+1,2,platesize/2,30,0
add limb a+1,3,1
rotate limb a+1,3,0,90,0
offset limb a+1,3,-platesize/2,30,0
endif
else
`up to left
if segment(a).direction=left
if segment(a-1).direction=up
`top wall
add limb a+1,2,1
offset limb a+1,2,0,30,platesize/2
`right wall
add limb a+1,3,1
rotate limb a+1,3,0,90,0
offset limb a+1,3,platesize/2,30,0
endif
endif
`up to right
if segment(a).direction=right
if segment(a-1).direction=up
`top wall
add limb a+1,2,1
offset limb a+1,2,0,30,platesize/2
`left wall
add limb a+1,3,1
rotate limb a+1,3,0,90,0
offset limb a+1,3,-platesize/2,30,0
endif
endif
`down to left
if segment(a).direction=left
if segment(a-1).direction=down
`right wall
add limb a+1,2,1
rotate limb a+1,2,0,90,0
offset limb a+1,2,platesize/2,30,0
`bottom wall
add limb a+1,3,1
offset limb a+1,3,0,30,-platesize/2
endif
endif
`down to right
if segment(a).direction=right
if segment(a-1).direction=down
`bottom wall
add limb a+1,2,1
offset limb a+1,2,0,30,-platesize/2
`left wall
add limb a+1,3,1
rotate limb a+1,3,0,90,0
offset limb a+1,3,-platesize/2,30,0
endif
endif
`left to up
if segment(a).direction=up
if segment(a-1).direction=left
`bottom wall
add limb a+1,2,1
offset limb a+1,2,0,30,-platesize/2
`left wall
add limb a+1,3,1
rotate limb a+1,3,0,90,0
offset limb a+1,3,-platesize/2,30,0
endif
endif
`left to down
if segment(a).direction=down
if segment(a-1).direction=left
`top wall
add limb a+1,2,1
offset limb a+1,2,0,30,platesize/2
`left wall
add limb a+1,3,1
rotate limb a+1,3,0,90,0
offset limb a+1,3,-platesize/2,30,0
endif
endif
`right to up
if segment(a).direction=up
if segment(a-1).direction=right
`right wall
add limb a+1,2,1
rotate limb a+1,2,0,90,0
offset limb a+1,2,platesize/2,30,0
`bottom wall
add limb a+1,3,1
offset limb a+1,3,0,30,-platesize/2
endif
endif
`right to down
if segment(a).direction=down
if segment(a-1).direction=right
`top wall
add limb a+1,2,1
offset limb a+1,2,0,30,platesize/2
`right wall
add limb a+1,3,1
rotate limb a+1,3,0,90,0
offset limb a+1,3,platesize/2,30,0
endif
endif
endif
endif
endif
endif
texture object a+1,texturenum
if a=1
add limb a+1,2,1
offset limb a+1,2,0,30,-platesize/2
add limb a+1,3,1
rotate limb a+1,3,0,90,0
offset limb a+1,3,platesize/2,30,0
add limb a+1,4,1
rotate limb a+1,4,0,90,0
offset limb a+1,4,-platesize/2,30,0
endif
if a=segmentnum
if segment(a).direction=left
add limb a+1,2,1
offset limb a+1,2,0,30,platesize/2
add limb a+1,3,1
offset limb a+1,3,0,30,-platesize/2
add limb a+1,4,1
rotate limb a+1,4,0,90,0
offset limb a+1,4,-platesize/2,30,0
endif
if segment(a).direction=right
add limb a+1,2,1
offset limb a+1,2,0,30,platesize/2
add limb a+1,3,1
offset limb a+1,3,0,30,-platesize/2
add limb a+1,4,1
rotate limb a+1,4,0,90,0
offset limb a+1,4,platesize/2,30,0
endif
if segment(a).direction=up
add limb a+1,2,1
rotate limb a+1,2,0,90,0
offset limb a+1,2,platesize/2,30,0
add limb a+1,3,1
rotate limb a+1,3,0,90,0
offset limb a+1,3,-platesize/2,30,0
add limb a+1,4,1
offset limb a+1,4,0,30,platesize/2
endif
if segment(a).direction=down
add limb a+1,2,1
rotate limb a+1,2,0,90,0
offset limb a+1,2,platesize/2,30,0
add limb a+1,3,1
rotate limb a+1,3,0,90,0
offset limb a+1,3,-platesize/2,30,0
add limb a+1,4,1
rotate limb a+1,4,0,90,0
offset limb a+1,4,-platesize/2,30,0
endif
endif
next a
delete mesh 1
delete mesh 2
endfunction
function makerandomcorridor2(segments as integer, maxturns as integer, turnnum as integer)
left=1
up=3
right=2
down=4
tempturn=0
tempcaves=0
for a=1 to segments
array insert at bottom segment(0)
if a=1
segment(a).position.x=0
segment(a).position.z=10
segment(a).direction=up
else
segment(a).direction=segment(a-1).direction
segment(a).turn=segment(a-1).direction
b=rnd(6)
`turn
if segment(a).direction=left
segment(a).position.x=segment(a-1).position.x-platesize
segment(a).position.z=segment(a-1).position.z
endif
if segment(a).direction=right
segment(a).position.x=segment(a-1).position.x+platesize
segment(a).position.z=segment(a-1).position.z
endif
if segment(a).direction=up
segment(a).position.x=segment(a-1).position.x
segment(a).position.z=segment(a-1).position.z+platesize
endif
if segment(a).direction=down
segment(a).position.x=segment(a-1).position.x
segment(a).position.z=segment(a-1).position.z-platesize
endif
if b=1
if tempturn<=maxturns
en=0
for j=1 to turnnum
if en=0
if a-j-1<=1
en=1
endif
if segment(a-j).direction<>segment(a-(j+1)).direction
en=1
endif
endif
next j
if en=0
c=rnd (2)
segment(a).turn=c
if segment(a-1).direction=left
if c=left then segment(a).direction=down
if c=right then segment(a).direction=up
endif
if segment(a-1).direction=right
if c=left then segment(a).direction=up
if c=right then segment(a).direction=down
endif
if segment(a-1).direction=up
if c=left then segment(a).direction=left
if c=right then segment(a).direction=right
endif
if segment(a-1).direction=down
if c=left then segment(a).direction=right
if c=right then segment(a).direction=left
endif
inc tempturn
endif
endif
endif
endif
make object box a+1,platesize,0.1,platesize
position object a+1,segment(a).position.x,0,segment(a).position.z
texture object a+1,12
next a
for f=1 to wallnum
for e=1 to wallnum
if f<>e
if segment(f).position.x=segment(e).position.x
if segment(f).position.z=segment(e).position.z
segment(f).collision=1
segment(e).collision=1
endif
endif
endif
next e
next f
endfunction
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--Return Value Functions--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function getangledifference(objnum as integer,x as integer, z as integer)
null = make vector3(1)
null = make vector3(2)
null = make vector3(3)
set vector3 1, x-object position x(objnum), 0,z-object position z(objnum)
normalize vector3 1,1
set vector3 2, limb position x(objnum, 1) - object position x(objnum), 0, limb position z(objnum, 1) - object position z(objnum)
normalize vector3 2, 2
AllyToTargetA# = acos(dot product vector3(1, 2))
set vector3 3, 0, 1, 0
cross product vector3 3, 2, 3
angle2# = acos(dot product vector3(1, 3))
if AllyToTargetA# > 0.1
if angle2# <> 0
if angle2# >= 90
exitfunction 1
else
exitfunction 2
endif
endif
endif
endfunction 0
function mousebox(top,left,sizex,sizey)
if mousex()>left
if mousex()<left+sizex
if mousey()>top
if mousey()<top+sizey
exitfunction 1
endif
endif
endif
endif
endfunction 0
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--Image Functions--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function custombox(xtolerance as integer,ytolerance as integer,xpos as integer,ypos as integer)
x=rnd(xtolerance)
y=rnd(ytolerance)
for x=xpos-(x/2) to xpos+(x/2)
for y=ypos-(y/2) to ypos+(y/2)
q=rnd(30)+50
dot x,y,rgb(q,q/2,q/2)
next y
next x
endfunction
function tex(s as string,color as dword)
ink color,color
center text screen width()/2, screen height()/2,s
endfunction
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--Other--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function swordattack(swordobj as integer, object as integer, rate as integer)
show object swordobj
position object swordobj, newxvalue(object position x(object),45+object angle y(object),4),object position y(object)+4,newzvalue(object position z(object),45+object angle y(object),4)
rotate object swordobj, object angle x(swordobj),object angle y(object),object angle z(swordobj)
if updown=1
rotate object swordobj, object angle x(swordobj)+rate, object angle y(swordobj),object angle z(swordobj)
endif
if updown=0
rotate object swordobj, object angle x(swordobj)-rate, object angle y(swordobj),object angle z(swordobj)
endif
p=wrapvalue(object angle x(swordobj))
if p>90 and p<110
updown=0
endif
if p<360 and p>340
updown=1
endif
text 100,0,str$(p)
endfunction
handlemouse:
if mouseclick()=1
camangle=curvevalue(wrapvalue(camangle)+mousemovex()/2,camangle,1)
endif
if mouseclick()=2
swordattack(1001,1,3)
endif
if mouseclick()<>2
swordobj=1001
object=1
position object swordobj, newxvalue(object position x(object),45+object angle y(object),4),object position y(object)+4,newzvalue(object position z(object),45+object angle y(object),4)
rotate object swordobj, 0,object angle y(object),object angle z(swordobj)
endif
return
init:
`make your player!
makelimbcube(1,10)
texture limb 1, 3,3
ColorCube(1,rgb(255,255,0))
`Sets the overall light for the level.
set ambient light 40
`The back of the cube looks wierd when it turns, so im placing a light at the camera's position.
make light 1
`Positions the object 5 above the ground, which is half it's height.
position object 1,0,5,0
`This is the object used for the sword. It is created now, andwill be resized/colored later when the person upgrades
`weapons.
make object box 1001,0.2, 15,1
return
function deletelevel(objnum)
empty array segment(0)
array insert at bottom segment(0)
empty array wall(0)
array insert at bottom wall(0)
empty array enemy(0)
array insert at bottom enemy(0)
for a=1 to 900
if object exist(a+1)
delete object a+1
endif
next a
endfunction
function makerandomenemies(kind as integer, number as integer, maptype as integer)
for a=1 to number
MakeLimbCube(500+a,10)
if kind=zombie
ColorCube(500+a, rgb(0,100,0))
texture limb 500+a,3,8
enemy(a).kind=kind
enemy(a).attack=0.1
enemy(a).health=100
endif
if kind=vampire
ColorCube(500+a, rgb(100,100,100))
texture limb 500+a,3,1
enemy(a).kind=kind
enemy(a).attack=0.1
enemy(a).health=100
endif
if kind=darkcube
Color object 500+a, rgb(0,0,0)
enemy(a).kind=kind
enemy(a).attack=0.1
enemy(a).health=100
endif
if maptype=2
segment=rnd(wallnum-4)+4
x=rnd(platesize-10)-platesize/2+5
z=rnd(platesize-10)-platesize/2+5
y=5
x=x+segment(segment).position.x
z=z+segment(segment).position.z
position object 500+a,x,y,z
endif
if maptype=1
intersect=0
x=rnd(800)+100
z=rnd(800)+100
for c=1 to wallnum
if x>wall(c).position.x-wall(c).width/2
if x(d)<wall(c).position.x+wall(c).width/2
if z(d)>wall(c).position.z-wall(c).width/2
if z(d)<wall(c).position.z+wall(c).width/2
intersect=1
endif
endif
endif
endif
next c
while intersect=1
intersect=0
x=rnd(800)+100
z=rnd(800)+100
for c=1 to wallnum
if x>wall(c).position.x-wall(c).width/2
if x(d)<wall(c).position.x+wall(c).width/2
if z(d)>wall(c).position.z-wall(c).width/2
if z(d)<wall(c).position.z+wall(c).width/2
intersect=1
endif
endif
endif
endif
next c
endwhile
endif
next a
endfunction
i finished that on friday night(Err, i changed the values so that each time you progress a level you go to a different map type, instead of having to go through 25 levels but...)
Eh, oh well. Your right though i did skimp out on the whole "Procedurally generated" concept. I should have focused on the linear type levels.
But, the last code i posted could still progress and go back through levels.