I'm quite sure I ended everything properly. I looked through several times, and I think everything has an endif, loop, next, etc...
I'm not sure what is wrong, but it says it "could not close nest at line 1075" which is the end of the script.
Rem Setup sync
Sync On
Sync Rate 30
dmn=1
dmw=640
dmh=480
dmdn=3
dmd=32
Set Display Mode dmw,dmh,dmd
Draw to front
Set camera view 0,0,1,1
menubox=1
red=RGB(255,0,0)
white=RGB(255,255,255)
load sound "hitwall.wav",11
gosub mainmenu
`MAIN MENU
mainmenu:
load image "monstergladiatorbanner.png",89
paste image 89,100,20
Do
Set Text Size 20
if menubox=1 then ink red,0 else ink white,0
text 20,150,"Start New Game"
if menubox=2 then ink red,0 else ink white,0
text 20,180,"Load Game"
if menubox=3 then ink red,0 else ink white,0
text 20,210,"Instructions"
if menubox=4 then ink red,0 else ink white,0
text 20,240,"Options"
if menubox=5 then ink red,0 else ink white,0
text 20,270,"Exit Game"
if upkey()=1 and hold=0 or keystate(17)=1 and hold=0 then dec menubox : hold=1
if downkey()=1 and hold=0 or keystate(31)=1 and hold=0 then inc menubox : hold=1
if downkey()=0 and upkey()=0 and keystate(17)=0 and keystate(31)=0 then hold=0
if menubox>5 then menubox=1
if menubox<1 then menubox=5
if returnkey()=1
play sound 11
wait 150
if menubox=1
cls
load image "monstergladiatorbanner.png",89
paste image 89,100,20
wait 1000
menubox=1
do
if upkey()=1 and hold=0 or keystate(17)=1 and hold=0 then dec menubox : hold=1
if downkey()=1 and hold=0 or keystate(31)=1 and hold=0 then inc menubox : hold=1
if downkey()=0 and upkey()=0 and keystate(17)=0 and keystate(31)=0 then hold=0
if menubox=1 then ink red,0 else ink white,0
if file exist("save1.txt")=0
text 20,150,"Save to File 1"
endif
if file exist("save1.txt")=1
text 20,150,"Save to File 1 - Save File 1 Already Exists"
endif
if menubox=2 then ink red,0 else ink white,0
if file exist("save2.txt")=0
text 20,180,"Save to File 2"
endif
if file exist("save2.txt")=1
text 20,180,"Save to File 2 - Save File 2 Already Exists"
endif
if menubox=3 then ink red,0 else ink white,0
if file exist("save3.txt")=0
text 20,210,"Save to File 3"
endif
if file exist("save3.txt")=1
text 20,210,"Save to File 3 - Save File 3 Already Exists"
endif
if menubox=4 then ink red,0 else ink white,0
if file exist("save4.txt")=0
text 20,240,"Save to File 4"
endif
if file exist("save4.txt")=1
text 20,240,"Save to File 4 - Save File 4 Already Exists"
endif
if menubox=5 then ink red,0 else ink white,0
if file exist("save5.txt")=0
text 20,270,"Save to File 5"
endif
if file exist("save4.txt")=1
text 20,270,"Save to File 5 - Save File 5 Already Exists"
endif
if returnkey()=1
if menubox=1
if file exist("save1.txt")=1
delete file "save1.txt"
endif
save=1
savefile$="save1.txt"
gosub NewGameVariables
gosub SaveGame
exit
exit
exit
exit
exit
endif
if menubox=2
if file exist("save2.txt")=2
delete file "save2.txt"
endif
save=2
savefile$="save2.txt"
gosub NewGameVariables
gosub SaveGame
exit
exit
exit
exit
exit
endif
if menubox=3
if file exist("save3.txt")=3
delete file "save3.txt"
endif
save=3
savefile$="save3.txt"
gosub NewGameVariables
gosub SaveGame
exit
exit
exit
exit
exit
endif
if menubox=4
if file exist("save4.txt")=4
delete file "save4.txt"
endif
save=4
savefile$="save4.txt"
gosub NewGameVariables
gosub SaveGame
exit
exit
exit
exit
exit
endif
if menubox=5
if file exist("save5.txt")=5
delete file "save5.txt"
endif
save=5
savefile$="save5.txt"
gosub NewGameVariables
gosub SaveGame
exit
exit
exit
exit
exit
endif
endif
sync
loop
endif
if menubox=2
cls
menubox=1
do
if upkey()=1 and hold=0 or keystate(17)=1 and hold=0 then dec menubox : hold=1
if downkey()=1 and hold=0 or keystate(31)=1 and hold=0 then inc menubox : hold=1
if downkey()=0 and upkey()=0 and keystate(17)=0 and keystate(31)=0 then hold=0
if file exist("save1.txt") then open to read 1,"save1.txt"
if file exist("save2.txt") then open to read 2,"save2.txt"
if file exist("save3.txt") then open to read 3,"save3.txt"
if file exist("save4.txt") then open to read 4,"save4.txt"
if file exist("save5.txt") then open to read 5,"save5.txt"
if menubox=1 then ink red,0 else ink white,0
text 20,90,"Save File 1"
ink white,0
read float 1,lv
read float 1,health
read float 1,maxhealth
read float 1,xp
read float 1,maxxp
set cursor 70,90
print lv
set cursor 70,120
print health,"/",maxhealth
set cursor 70,150
print xp,"/",maxxp
if menubox=2 then ink red,0 else ink white,0
text 20,190,"Save File 2"
ink white,0
read float 2,lv
read float 2,health
read float 2,maxhealth
read float 2,xp
read float 2,maxxp
set cursor 70,190
print lv
set cursor 70,220
print health,"/",maxhealth
set cursor 70,250
print xp,"/",maxxp
if menubox=3 then ink red,0 else ink white,0
text 20,290,"Save File 3"
ink white,0
read float 3,lv
read float 3,health
read float 3,maxhealth
read float 3,xp
read float 3,maxxp
set cursor 70,290
print lv
set cursor 70,320
print health,"/",maxhealth
set cursor 70,350
print xp,"/",maxxp
if menubox=4 then ink red,0 else ink white,0
text 20,390,"Save File 4"
ink white,0
read float 4,lv
read float 4,health
read float 4,maxhealth
read float 4,xp
read float 4,maxxp
set cursor 70,390
print lv
set cursor 70,420
print health,"/",maxhealth
set cursor 70,450
print xp,"/",maxxp
if menubox=5 then ink red,0 else ink white,0
text 20,490,"Save File 5"
ink white,0
read float 5,lv
read float 5,health
read float 5,maxhealth
read float 5,xp
read float 5,maxxp
set cursor 70,490
print lv
set cursor 70,520
print health,"/",maxhealth
set cursor 70,550
print xp,"/",maxxp
if returnkey()=1
if menubox=1
save=1
savefile$="save1.txt"
endif
if menubox=2
save=2
savefile$="save2.txt"
endif
if menubox=3
save=3
savefile$="save3.txt"
endif
if menubox=4
save=4
savefile$="save4.txt"
endif
if menubox=5
save=5
savefile$="save5.txt"
endif
read float save,lv
read float save,health
read float save,maxhealth
read float save,ammo
read float save,dmg
read float save,xp
read float save,maxxp
read float save,monsterhp
read float save,monstermhp
read float save,monsterxp
read float save,monstermxp
read float save,monsterdmg
read float save,monsterlv
cls
exit
exit
exit
exit
exit
endif
sync
loop
endif
if menubox=3
load image "Instructions.png",88
paste image 88,0,0
sync:sync
wait key
delete image 88
cls
wait 100
load image "monstergladiatorbanner.png",89
paste image 89,100,20
endif
if menubox=4
gosub options
endif
if menubox=5
end
endif
endif
Sync
Loop
options:
menubox=1
Do
if upkey()=1 and hold=0 or keystate(17)=1 and hold=0 then dec menubox : hold=1
if downkey()=1 and hold=0 or keystate(31)=1 and hold=0 then inc menubox : hold=1
if downkey()=0 and upkey()=0 and keystate(17)=0 and keystate(31)=0 then hold=0
if menubox=1 then ink red,0 else ink white,0
set cursor 20,150
print "Screen Resolution: ",dmw,"x",dmh
if menubox=1 and leftkey()=1 and hold=0 or keystate(30)=1 and hold=0 then dec dmn : hold=1
if menubox=1 and rightkey()=1 and hold=0 or keystate(32)=1 and hold=0 then inc dmn : hold=1
if leftkey()=0 and rightkey()=0 and keystate(30)=0 and keystate(32)=0 then hold=0
if dmn<1 then dmn=1
if dmn>3 then dmn=3
if dmn = 1 then dmw=640 and dmh=480
if dmn = 2 then dmw=800 and dmh=600
if dmn = 3 then dmw=1024 and dmh=768
if menubox=2 then ink red,0 else ink white,0
set cursor 20,200
print "Screen Depth: ",dmd
if menubox=2 and leftkey()=1 and hold=0 or keystate(30)=1 and hold=0 then dec dmdn : hold=1
if menubox=2 and rightkey()=1 and hold=0 or keystate(32)=1 and hold=0 then inc dmdn : hold=1
if leftkey()=0 and rightkey()=0 and keystate(30)=0 and keystate(32)=0 then hold=0
if dmdn<1 then dmdn=1
if dmdn>3 then dmdn=3
if dmdn=1 then dmd=8
if dmdn=2 then dmd=16
if dmdn=3 then dmd=32
if menubox=3 then ink red,0 else ink white,0
text 20,250,"Return to Main Menu"
if ReturnKey()=1
if menubox=3
set display mode dmw,dmh,dmd
gosub mainmenu
endif
endif
sync
Loop
NewGameVariables:
`Set Up variables
lv=1
health = 20
maxhealth=20+(lv*2)
ammo = 8
dmg=4+lv
reload = 0
time#= 0
shoot=0
stime#=0
xp=0
maxxp=10*lv*1.2
`Monster Variables
monsterlv=1
monsterhp=10
monstermhp=10+(monsterlv*2)
monsterxp=0
monstermxp=10*monsterlv*1.2
monsterdmg=4+monsterlv
return
Set camera range 1,3000
Autocam off
Hide mouse
Backdrop On
Fog on
Fog distance 3000
Fog color RGB(128,128,128)
Color Backdrop RGB(128,128,128)
Rem make matrix
Make matrix 1,7000,7000,10,10
Rem texture matrix
Load image "GRASS09.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1
rem Randomize the matrix
randomize matrix 1,200
update matrix 1
X#=5000
Z#=5000
rem Make Gun
Make object cylinder 1,2
XRotate Object 1,90
Fix object pivot 1
Scale object 1,100,100,500
position object 1,0.5,-1,1.5
Lock object on 1
disable object zdepth 1
rem make HUD
Make object Plain 200,1,1
position object 200,-2.7,1.9,4
Lock object on 200
ghost object on 200
Make object Plain 201,1,1
position object 201,2.7,1.9,4
Lock object on 201
ghost object on 201
Load image "score.bmp",201
Texture object 201,201
`Make crosshairs
Make object Plain 999,1,1
position object 999,0,0,8
Lock object on 999
ghost object on 999
Load image "Crosshairs.png",999
Texture object 999,999
rem Load and create hud bitmaps.
Load Bitmap "Radar.bmp",2
Create Bitmap 1,50,50
rem fire texture
Load Image "fire.bmp",2
rem Make Bullet
Make Object Sphere 2,2
texture object 2,2
Hide Object 2
rem Make MonsterBullet
Make Object Sphere 102,2
texture object 102,2
Hide Object 102
rem Make Explosion
Make Object Sphere 30,20
texture object 30,2
ghost object on 30
Hide Object 30
Make Object Sphere 31,20
texture object 31,2
ghost object on 31
Hide Object 31
rem Make Monster Explosion
Make Object Sphere 130,20
texture object 130,2
ghost object on 130
Hide Object 130
Make Object Sphere 131,20
texture object 131,2
ghost object on 131
Hide Object 131
rem load particles
For x = 0 to 10
Make object plain x+10,5,5
Texture object x+10,2
Set object x+10,1,0,0
Ghost object on x+10
Hide object x+10
Next x
rem load Monsterparticles
Load Image "fire.bmp",2
For x =100 to 110
Make object plain x+10,5,5
Texture object x+10,2
Set object x+10,1,0,0
Ghost object on x+10
Hide object x+10
Next x
rem intialize particle counter
Pn=10
MPn=110
rem load sounds
Load sound "crickets.wav",1
Loop sound 1
load sound "Explode.wav",20
Load 3Dsound "fireball2.wav",2
Load 3Dsound "fireball2.wav",102
Load 3Dsound "Explode.wav",3
Load 3Dsound "Explode.wav",103
rem create decorative objects
load image "cottag02.bmp",300
t=300
For x = 1 to 7
For z = 1 to 7
Make object cube t,100
Scale object t,100,600,100
y = get ground height(1,x*1000,z*1000)
position object t,x*1000,y+275,z*1000
texture object t,300
scale object texture t,1,-6
inc t
next z
next x
Rem Load Target
Load object "idle.x",3
Append Object "Walk.x",3,21
Yrotate object 3,180
Fix Object Pivot 3
Loop Object 3
mX# = 5000
mZ# = 5000
mY# = Get Ground Height(1,5000,5000)
X# = 5500
Y# = Get Ground Height(1,5500,5500)
Z# = 5500
MonsterScore=0
PlayerScore=0
Gosub PlaceMonster
Gosub PlacePlayer
set camera view 0,0,640,480
Rem Main loop
Do
TEXT 0,SCREEN HEIGHT()-60,"Ammo: "+str$(ammo)
set cursor 0,100
print "Player Level: ",lv
set cursor 0,120
print "Player Health: ",health,"/",maxhealth
set cursor 0,140
print "Player EXP: ",xp,"/",maxxp
set cursor 450,400
print "Monster Level: ",monsterlv
set cursor 450,420
print "Monster Health: ",monsterhp,"/",monstermhp
set cursor 450,440
print "Monster EXP: ",monsterxp,"/",monstermxp
set cursor 550,20
print "MScore: ",MonsterScore
set cursor 550,40
print "PScore: ",PlayerScore
oldcAY# = cAY#
oldcAX# = cAX#
oldX#=X#
oldY#=Y#
oldZ#=Z#
cAY# = WrapValue(cAY#+MousemoveX()*0.2)
cAX# = WrapValue(cAX#+MousemoveY()*0.2)
caZ# = Camera angle Z()
Rem Control input for camera
If KeyState(17)=1
XTest# = Newxvalue(X#,cAY#,7)
ZTest# = Newzvalue(Z#,cAY#,7)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
If KeyState(31)=1
XTest# = Newxvalue(X#,Wrapvalue(cAY#-180),7)
ZTest# = Newzvalue(Z#,Wrapvalue(cAY#-180),7)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
If KeyState(30)=1
XTest# = Newxvalue(X#,Wrapvalue(cAY#-90),7)
ZTest# = Newzvalue(Z#,Wrapvalue(cAY#-90),7)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
If KeyState(32)=1
XTest# = Newxvalue(X#,Wrapvalue(cAY#+90),7)
ZTest# = Newzvalue(Z#,Wrapvalue(cAY#+90),7)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
if escapekey()=1
gosub mainmenu
endif
IF MOUSECLICK()=0 AND KEYSTATE(19)=1
reload=1
text screen width()/2,screen height()/2,"RELOADING..."
endif
If reload=1 then inc time#,.1
if time#>1 then ammo=8:time#=0:reload=0:cls
Rem Rotate camera
cTestX#=WrapValue(cAX#-180)
if cTestX# > 225 then cAX#=45
if cTestX# < 135 then cAX#=315
YRotate camera CurveAngle(cAY#,oldcAY#,24)
XRotate camera CurveAngle(cAX#,oldcAX#,24)
Y# = Get ground height(1,X#,Z#)+35
rem collision detection
if DecoCollide(X#,Y#,Z#) = 1
X#=oldX#
Y#=oldY#
Z#=oldZ#
Endif
Rem Position Camera
Position Camera X#,Y#,Z#
Rem Position Listener
Position Listener X#,Y#,Z#
Rotate Listener 0,cAY#,0
Rem Shoot bullet
if Mouseclick()=1 and Explode =0 and ammo>0
if BulletLife=0 or BulletLife<50
Position object 2,X#,Y#-7,Z#
Set object to camera orientation 2
BulletLife =180
Dec ammo,1
show object 2
Loop sound 2
Endif
Endif
If BulletLife > 0 then Gosub ShootBullet
If MonsterBulletLife > 0 then Gosub MonsterShootBullet
If Explode > 0 then Gosub ExplodeRocket
If MonsterExplode > 0
Gosub MonsterExplodeRocket
else
Gosub MonsterAI
Endif
Rem make radar
Copy Bitmap 2,1
set current bitmap 1
ink rgb(0,0,255),rgb(0,0,0)
PRX#=X#/200
PRZ#=50-(Z#/200)
Circle PRX#,PRZ#,1
ink rgb(255,0,0),rgb(0,0,0)
MRX#=mX#/200
MRZ#=50-(mZ#/200)
Circle MRX#,MRZ#,1
Get image 200,0,0,50,50
set current bitmap 0
texture object 200,200
ink rgb(255,128,128),rgb(0,0,0)
`Leveling System
if xp>=maxxp
xp=0
lv=lv+1
dmg=4+lv
maxhealth=20+(lv*2)
maxxp=10*lv*1.2
health=maxhealth
endif
if monsterxp>=monstermxp
monsterxp=0
monsterlv=monsterlv+1
monstermhp=10+(monsterlv*2)
monstermxp=10*monsterlv*1.2
monsterdmg=4+monsterlv
monsterhp=monstermhp
endif
Rem Refresh Screen
if kmtime>0 then dec kmtime,1
if kmtime=1 then cls
if kbmtime>0 then dec kbmtime,1
if kbmtime=1 then cls
Sync
Loop
Rem check for collision with wall decorations
Function DecoCollide(X#,Y#,Z#)
for u = 1 to 9
for v = 1 to 9
if X#>u*1000-60
if X#<u*1000+60
if Z#>v*1000-60
if Z#<v*1000+60
if Y# < Get ground height(1,u*1000,v*1000)+575
Collide=1
Exitfunction Collide
endif
endif
endif
endif
endif
next v
next u
Collide=0
Endfunction Collide
Rem Shoot player bullet
ShootBullet:
Dec BulletLife
Move object 2,12
bX#=Object position X(2)
bY#=Object position Y(2)
bZ#=Object position Z(2)
inc Pn
if Pn=21 then Pn=10
Scale object Pn,100,100,100
Position object Pn,bX#,bY#,bZ#
point object Pn,X#,Y#,Z#
Zrotate object Pn,rnd(180)
Show object Pn
for x = 1 to 10
scale object int((Wrapvalue((Pn-9+x)*36))/36)+10,100+x*25,100+x*25,100+x*25
set cursor 10,10
next x
if bY# < Get Ground height(1,bX#,bZ#) then BulletLife=0
Position sound 2,bX#,bY#,bZ#
set cursor 10,10
if Sqrt((mX# - bX#)^2 + (mY#+25 - bY#)^2 + (mZ# - bZ#)^2) <20
BulletLife=0
monsterhp=monsterhp-dmg
if monsterhp<1
gosub MK
Gosub PlaceMonster
inc PlayerScore
inc xp,5+(monsterlv*1.5)
MonsterBulletLife = 1
endif
endif
if DecoCollide(bX#,bY#,bZ#) = 1 then BulletLife = 0
if BulletLife = 0
Hide object 2
stop sound 2
for x=10 to 20
hide object x
next x
Explode = 20
endif
Return
Rem Explode bullet
ExplodeRocket:
Position object 30,bX#,bY#,bZ#
Show object 30
Position object 31,bX#,bY#,bZ#
Show object 31
EScale=20*(30-Explode)
Scale object 30,EScale,EScale,EScale
Yrotate object 30,WrapValue(Explode*37)
Scale object 31,EScale/1.5,EScale/1.5,EScale/1.5
Yrotate object 31,WrapValue(359-Explode*37)
Dec Explode
If Explode = 0 then hide object 30: Hide object 31
If Explode=18
position sound 3,bX#,bY#,bZ#
play sound 3
endif
If Explode < 15 then position sound 3,X#,Y#,Z#
Return
Rem Explode monster bullet
MonsterExplodeRocket:
Position object 130,MbX#,MbY#,MbZ#
Show object 130
Position object 131,MbX#,MbY#,MbZ#
Show object 131
EScale=20*(30-MonsterExplode)
Scale object 130,EScale,EScale,EScale
Yrotate object 130,WrapValue(MonsterExplode*37)
Scale object 131,EScale/1.5,EScale/1.5,EScale/1.5
Yrotate object 131,WrapValue(359-MonsterExplode*37)
Dec MonsterExplode
If MonsterExplode = 0 then hide object 130: Hide object 131
If MonsterExplode=18
position sound 103,X#,Y#,Z#
play sound 103
endif
If MonsterExplode < 15 then position sound 103,X#,Y#,Z#
Return
Rem Simple AI for guided monster misile
MonsterAI:
Point object 3,X#,Y#,Z#
If AvoidDeco >0
mA# = Object Angle Y(3)
Dec AvoidDeco
Yrotate object 3,WrapValue(mA#+AvoidDeco*60)
endif
Rem Position Monster at new location
Position Object 3,mX#,mY#,mZ#
Rem check distance from player
PDist=Sqrt((mX# - X#)^2 + (mY#+25 - Y#)^2 + (mZ# - Z#)^2)
Rem If the player is within range shoot bullet
if PDist<1500
if MonsterBulletLife=0 or MonsterBulletLife < 500-Pdist/10
Point object 3,X#,Y#-25,Z#
If BulletAvoidDeco > 0
CornerAim = Rnd(1)
mA# = object angle Y(3)
if CornerAim = 0 then Yrotate Object 3,WrapValue(mA#+BulletAvoidDeco*10)
if CornerAim = 1 then Yrotate Object 3,WrapValue(mA#+BulletAvoidDeco*-16)
Dec BulletAvoidDeco
Endif
If ShootUp > 0
mA# = object angle X(3)
XRotate Object 3,WrapValue(mA#+ShootUp*-8)
Dec ShootUp
Endif
Position object 102,mX#,mY#+25,mZ#
Set object to object orientation 102,3
MonsterBulletLife =500
show object 102
Loop sound 102
Rem Play idle animation
Loop Object 3,0,20
Endif
Endif
if PDist>1000
Rem Store old location
OldmX# = mX#
OldmZ# = mZ#
OldmY# = mY#
Rem Play walking animation
Loop Object 3,21,46
Rem Move monster
Move Object 3,7
Rem Get new position
mX# = Object Position X(3)
mZ# = Object Position Z(3)
mY# = Get Ground Height(1,mX#,mZ#)
Rem Check for Decoration collision
If DecoCollide(mX#,mY#,mZ#) = 1 and AvoidDeco = 0
mX# = OldmX#
mZ# = OldmZ#
mY# = OldmY#
AvoidDeco = 3
Endif
Endif
Return
Rem Shoot Monster bullet
MonsterShootBullet:
Dec MonsterBulletLife
Move object 102,12
MbX#=Object position X(102)
MbY#=Object position Y(102)
MbZ#=Object position Z(102)
inc MPn
if MPn=121 then MPn=110
Scale object MPn,100,100,100
Position object MPn,MbX#,MbY#,MbZ#
Position sound 102,MbX#,MbY#,MbZ#
point object MPn,X#,Y#,Z#
Zrotate object MPn,rnd(180)
Show object MPn
for x = 1 to 10
scale object int((Wrapvalue((MPn-9+x)*36))/36)+110,100+x*25,100+x*25,100+x*25
next x
if MbY# < Get Ground height(1,MbX#,MbZ#)
MonsterBulletLife=0
ShootUp=3
endif
Pdist=Sqrt((X# - MbX#)^2 + (Y#+25 - MbY#)^2 + (Z# - MbZ#)^2)
if Pdist<50
MonsterBulletLife = 0
Dec health,monsterdmg
if health<1
GoSub KbM
GoSub PlacePlayer
inc MonsterScore
inc monsterxp,5+(lv*1.5)
endif
endif
Rem guided missile
if Pdist <500+PlayerScore*100 and Pdist>250 then Point object 102,X#,Y#,Z#
if Pdist < 100 then point object 102,X#,Y#,Z#
if DecoCollide(MbX#,MbY#,MbZ#) = 1
MonsterBulletLife = 0
BulletAvoidDeco = BulletAvoidDeco + 2
Endif
if MonsterBulletLife = 0
Hide object 102
stop sound 102
for x=110 to 120
hide object x
next x
MonsterExplode = 20
endif
Return
MK:
set text size 50
text 150,100,"Killed Monster"
kmtime=20
return
KbM:
set text size 50
text 120,100,"Killed by Monster"
kbmtime=20
return
PlaceMonster:
mX#=X#
mY#=Y#
mZ#=Z#
While Sqrt((X# - MX#)^2 + (Y#+25 - MY#)^2 + (Z# - MZ#)^2)<1000
mX#=rnd(7000)
mZ#=rnd(8000)
mY#= get ground height(1,mX#,mZ#)
monsterhp=monstermhp
If DecoCollide(mX#,mY#,mZ#) = 1
mX#=X#
mY#=Y#
mZ#=Z#
endif
EndWhile
Position object 3,mX#,mY#,mZ#
Return
PlacePlayer:
X#=mX#
Y#=mY#
Z#=mZ#
While Sqrt((X# - mX#)^2 + (Y#+25 - mY#)^2 + (Z# - mZ#)^2)<1000
health=maxhealth
X#=rnd(7000)
Z#=rnd(8000)
Y#= get ground height(1,X#,Z#)
If DecoCollide(X#,Y#,Z#) = 1
X#=mX#
Y#=mY#
Z#=mZ#
endif
EndWhile
Position camera X#,Y#,Z#
Point camera mX#,mY#,mZ#
Return
SaveGame:
if file exist(savefile$)=1
delete file savefile$
open to write save,savefile$
write float save,lv
write float save,xp
write float save,health
write float save,maxhealth
write float save,ammo
write float save,dmg
write float save,maxxp
write float save,monsterlv
write float save,monsterhp
write float save,monstermhp
write float save,monsterxp
write float save,monstermxp
write float save,monsterdmg
close file save
return
IGMenu:
Set Text Size 50
menubox=1
do
if upkey()=1 and hold=0 or keystate(17)=1 and hold=0 then dec menubox : hold=1
if downkey()=1 and hold=0 or keystate(31)=1 and hold=0 then inc menubox : hold=1
if downkey()=0 and upkey()=0 and keystate(17)=0 and keystate(31)=0 then hold=0
if menubox=1 then ink red,0 else ink white,0
text 150,100,"Resume Game"
if menubox=2 then ink red,0 else ink white,0
text 150,150,"Save Game"
if menubox=3 then ink red,0 else ink white,0
text 150,200,"Back to Main Menu"
if menubox=4 then ink red,0 else ink white,0
text 150,250,"Exit the Game"
if menubox>4 then menubox=4
if menubox<1 then menubox=1
if returnkey()=1
if menubox=1
exit
exit
exit
endif
if menubox=2
gosub SaveGame
endif
if menubox=3
gosub mainmenu
endif
if menubox=4
end
endif
endif
sync
loop
Can anyone help me?