/*̂̓GeĂȂ𒼂āAG̃Aj[VĂ݂܂B
ÔQ͂ɓG̍UA@̏܂B
;ff ̕܂B
*/

*initialize
randomize
title "submarine hideout"
screen 0,800,600,0
picload "haikeia.bmp"
buffer 1
picload "p.bmp"
buffer 2
picload "pshell.bmp"
buffer 3
picload "pshells.bmp"
buffer 4
picload "el.bmp"
buffer 5
picload "er.bmp"
buffer 6
picload "es.bmp"
buffer 7
picload "bmb_n2.gif"
buffer 8
picload "haikeia.bmp"
buffer 9
picload "tshell.gif"
;	
buffer 10
picload "boss4.gif"
buffer 11
picload "V^Cg.jpg"
; BGMmm@ʉmci
mmload "game_maoudamashii_1_battle23.mp3",0.1;퓬
mmload "game_maoudamashii_2_boss03.mp3",1,1;{X
mmload "game_maoudamashii_4_field09.mp3",2,1;NA
mmload "game_maoudamashii_4_field05.mp3",3,1;X^[g
mmplay 3



gsel 0
	color  255,255,255
	gmode 4,0,0,256
	pos 20,-5
	gcopy 11,0,0,773,128
	color  255,255,255
	font "lr ",30,1
	pos 20,200:mes {"L[Ŏ@܂
	Xy[X{^Ŕ𔭎˂܂(ʏɂR܂Łj"}
	color 255,255,0
	font "lr ",70,1
	pos 100,350:mes "PUSH Space button"
	pos 200,430:mes     "GAME START"
	repeat
	stick key,21
	if key&16 :goto *start;Xy[XL[ƃQ[n܂܂
	await 10
	loop	
;	

*start
mmplay 0;BGMĐ	
redraw 0	
picload "haikeia.bmp";	
dim ps,3:dim psx,3:dim psy,3

px=300:py=71
e1=0:ex1=900:ey1=200
e2=0:ex2=1000:ey2=400
e3=0:ex3=-250:ey3=300
e4=0:ex4=-350:ey4=500
SCORE=0
emove=0
boss=0
bossp=0

;ff




//repeat 8
//sx(cnt)=1000:sy(cnt)=1000
//loop

//es(6)=1:es(7)=1


*start2
repeat
redraw 0
stick key,21
gosub *pmove
if emove=0{;emove*bossprepare@422s
gosub *emove1
gosub *emove2
gosub *emove3
gosub *emove4
}
;ff
gosub *ebreak
if boss=0:gosub *SCOREa ;SCORE\܂ boss452s
if bossp>=1 :gosub *bossprepare;{X폀̃[`
/*{X*/if boss=1{
gosub *bosshp;{X̂go\܂
gosub *bmove;{X̓̃[`
gosub *battack;{X̍Ũ[`
}
	repeat 3
	c=cnt
	gosub *pshell
	loop
	

	gosub *tshell1


redraw 1
await 10
loop

*pmove;@̓
if key&1:px--:if px<0:px=0
if key&4:px++:if px>650:px=650
gsel 0
pos px,py
gcopy 1,0,0,150,30
return

*pshell;@̒ȅ
if ps(c)=0 and ss=0{
	if key&16{mci "play spo_ge_shooting_g02.mp3"
		psx(c)=px+60:psy(c)=py+20
		ps(c)=1:key=0
		ss=50
	}
}
else{
	psy(c)=psy(c)+1
	if psy(c)>600:ps(c)=0
}

if ps(c)=1{
	gsel 0
	pos psx(c),psy(c)-1
	gcopy 3,0,0,15,15
	gsel 0
	pos psx(c),psy(c)
	gcopy 2,0,0,15,15
}
ss=ss-1
if ss<0 : ss=0
return

*emove1
if e1=0{
	e1=1:ex1=900:ey1=200
}
else{
	ex1=ex1-1
	if ex1<-200:e1=0
}

if e1=1{
	gsel 0
	pos ex1+1,ey1
	gcopy 6,0,0,150,40
	gsel 0
	pos ex1,ey1
	gcopy 4,0,0,150,40
}

repeat 3
	if ex1<=psx(cnt)+15 and ex1+150>=psx(cnt) and ey1<=psy(cnt)+15 and ey1+40>=psy(cnt){	
	    e1=0
		;ff
		exb1=ex1:eyb1=ey1:eb1=1
		;ff
		gsel 0
		pos ex1,ey1
		gcopy 6,0,0,150,40
		gsel 0
		pos psx(cnt),psy(cnt)
		gcopy 3,0,0,15,15
		psy(cnt)=psy(cnt)+600
		pos ex1,ey1
		SCORE=SCORE+1
		if SCORE>=10:goto*bossprepare
		
		
	}
loop

return
*emove2
if e2=0{
	e2=1:ex2=1000:ey2=400
}
else{
	ex2=ex2-2
	if ex2<-200:e2=0
}

if e2=1{
	gsel 0
	pos ex2+2,ey2
	gcopy 6,0,0,150,40
	gsel 0
	pos ex2,ey2
	gcopy 4,0,0,150,40
}

repeat 3
	if ex2<=psx(cnt)+15 and ex2+150>=psx(cnt) and ey2<=psy(cnt)+15 and ey2+40>=psy(cnt){	
		e2=0
		;ff
		exb2=ex2:eyb2=ey2:eb2=1
		;ff
		gsel 0
		pos ex2,ey2
		gcopy 6,0,0,150,40
		gsel 0
		pos psx(cnt),psy(cnt)
		gcopy 3,0,0,15,15
		psy(cnt)=psy(cnt)+600
		SCORE=SCORE+1
		if SCORE>=10:goto*bossprepare
	}
loop

return
*emove3
if e3=0{
	e3=1:ex3=-250:ey3=300
}
else{
	ex3=ex3+2
	if ex3>850:e3=0
}

if e3=1{
	gsel 0
	pos ex3-2,ey3
	gcopy 6,0,0,150,40
	gsel 0
	pos ex3,ey3
	gcopy 5,0,0,150,40
}


repeat 3
	if ex3<=psx(cnt)+15 and ex3+150>=psx(cnt) and ey3<=psy(cnt)+15 and ey3+40>=psy(cnt){
		e3=0
		;ff
		exb3=ex3:eyb3=ey3:eb3=1
		;ff
		gsel 0
		pos ex3,ey3
		gcopy 6,0,0,150,40
		gsel 0
		pos psx(cnt),psy(cnt)
		gcopy 3,0,0,15,15
		psy(cnt)=psy(cnt)+600
		SCORE=SCORE+1
		if SCORE>=10:goto*bossprepare
	}
loop

*emove4
if e4=0{
	e4=1:ex4=-350:ey4=500
}
else{
	ex4=ex4+1
	if ex4>850:e4=0
}

if e4=1{
	gsel 0
	pos ex4-1,ey4
	gcopy 6,0,0,150,40
	gsel 0
	pos ex4,ey4
	gcopy 5,0,0,150,40
}

repeat 3
	if ex4<=psx(cnt)+15 and ex4+150>=psx(cnt) and ey4<=psy(cnt)+15 and ey4+40>=psy(cnt){	
		e4=0
		;ff
		exb4=ex4:eyb4=ey4:eb4=1
		;ff
		gsel 0
		pos ex4,ey4
		gcopy 6,0,0,150,40
		gsel 0
		pos psx(cnt),psy(cnt)
		gcopy 3,0,0,15,15
		psy(cnt)=psy(cnt)+600
		SCORE=SCORE+1
		if SCORE>=10:goto*bossprepare
	}
loop

return
;ff
*ebreak;G̔̏ 
if eb1=1 { eb1t=eb1t+1 :gmode 2:pos exb1,eyb1
    if eb1t=1 :gcopy 7,0,0,135,120:mci "play 1.mp3"
	if eb1t=3 :gcopy 7,135,0,135,120
	if eb1t=5 :gcopy 7,0,130,135,120
	if eb1t=7 :gcopy 7,135,130,135,120
	if eb1t=9 :gcopy 8,300,300,135,120:eb1=0:eb1t=0
	}
if eb2=1 { eb2t=eb2t+1 :gmode 2:pos exb2,eyb2
    if eb2t=2 :gcopy 7,0,0,135,120:mci "play 1.mp3"
	if eb2t=3 :gcopy 7,135,0,135,120
	if eb2t=5 :gcopy 7,0,130,135,120
	if eb2t=7 :gcopy 7,135,130,135,120
	if eb2t=9 :gcopy 8,300,300,135,120:eb2=0:eb2t=0
	}
if eb3=1 { eb3t=eb3t+1 :gmode 2:pos exb3,eyb3
    if eb3t=2 :gcopy 7,0,0,135,120:mci "play 1.mp3"
	if eb3t=3 :gcopy 7,135,0,135,120
	if eb3t=5 :gcopy 7,0,130,135,120
	if eb3t=7 :gcopy 7,135,130,135,120
	if eb3t=9 :gcopy 8,300,300,135,120:eb3=0:eb3t=0
	}
if eb4=1 { eb4t=eb4t+1 :gmode 2:pos exb4,eyb4
    if eb4t=2 :gcopy 7,0,0,135,120:mci "play 1.mp3"
	if eb4t=3 :gcopy 7,135,0,135,120
	if eb4t=5 :gcopy 7,0,130,135,120
	if eb4t=7 :gcopy 7,135,130,135,120
	if eb4t=9 :gcopy 8,300,300,135,120:eb4=0:eb4t=0
	}
return
*SCOREa;SCORE\܂
	pos 650,0
	gcopy 8,650,0,135,50
	font "lr ",20,1:color 0,0,0:pos 650,0
	mes "SCORE@@/10"
	font "lr ",20,1:pos 760,0
	mes ""
	font "lr ",20,1:color 0,0,0:pos 730,0:mes SCORE
	return
;ff
*tshell1;G̒ȅ
if es1=0  {est1=est1+rnd(10)
		if est1>1000{ est1=0:es1=1 :esx1=ex1 :esy1=ey1+20;est1>̌̐قǍUԊuȂ܂
		mci "play spo_ge_shooting_g01.mp3"
		}}
else{
	esy1=esy1-1
	if esy1<=100{es1=0
	gsel 0
	pos esx1,esy1+1
	gcopy 3,0,0,15,15}}
if es1=1{

	gsel 0
	pos esx1,esy1+1
	gcopy 3,0,0,15,15
	gsel 0
	pos esx1,esy1
	gcopy 9,0,0,15,15
if px+10<=esx1+15 and px+140>=esx1 and py+30=esy1 :goto *gameover;G̒e̓蔻
}
*tshell2
if es2=0  {est2=est2+rnd(10)
		if est2>1000{ est2=0:es2=1 :esx2=ex2 :esy2=ey2+20
		mci "play spo_ge_shooting_g01.mp3"
		}}
else{
	esy2=esy2-1
	if esy2<=100{es2=0
	gsel 0
	pos esx2,esy2+1
	gcopy 3,0,0,15,15}}
if es2=1{

	gsel 0
	pos esx2,esy2+1
	gcopy 3,0,0,15,15
	gsel 0
	pos esx2,esy2
	gcopy 9,0,0,15,15
if  px+10<=esx2+15 and px+140>=esx2 and py+30=esy2 :goto *gameover
}
*tshell3
if es3=0  {est3=est3+rnd(10)
		if est3>1000{ est3=0:es3=1 :esx3=ex3 :esy3=ey3+20
		mci "play spo_ge_shooting_g01.mp3"
		}}
else{
	esy3=esy3-1
	if esy3<=100{es3=0
	gsel 0
	pos esx3,esy3+1
	gcopy 3,0,0,15,15}}
if es3=1{

	gsel 0
	pos esx3,esy3+1
	gcopy 3,0,0,15,15
	gsel 0
	pos esx3,esy3
	gcopy 9,0,0,15,15
if  px+10<=esx3+15 and px+140>=esx3 and py+30=esy3 :goto *gameover
} 
*tshell4
if es4=0  {est4=est4+rnd(10)
		if est4>1000{ est4=0:es4=1 :esx4=ex4 :esy4=ey4+20
		mci "play spo_ge_shooting_g01.mp3"
		}}
else{
	esy4=esy4-1
	if esy4<=100{es4=0
	gsel 0
	pos esx4,esy4+1
	gcopy 3,0,0,15,15}}
if es4=1{

	gsel 0
	pos esx4,esy4+1
	gcopy 3,0,0,15,15
	gsel 0
	pos esx4,esy4
	gcopy 9,0,0,15,15
if  px+10<=esx4+15 and px+140>=esx4 and py+30=esy4 :goto *gameover
} 
return
*bossprepare;{X̏܂
bossp=bossp+1
if bossp=1 {
			mmstop;BGM~ 
			mci "play meka_ge_keihou01.mp3";TC
			exb1=ex1:eyb1=ey1:eb1=1;GGSł܂
			exb2=ex2:eyb2=ey2:eb2=1
			exb3=ex3:eyb3=ey3:eb3=1
			exb4=ex4:eyb4=ey4:eb4=1
			pos 0,200
			gcopy 8,0,200,800,500
			font "lr ",150,1:color 255,0,0:pos 230,280
			mes "B"
			emove=1
			goto *start2
		}
if bossp=50{e1=0:ex1=900:ey1=200
			e2=0:ex2=1000:ey2=400
			e3=0:ex3=-250:ey3=300
			e4=0:ex4=-350:ey4=500
			font "lr ",150,1:color 255,0,0:pos 230,280
			mes "B"
			font "lr ",150,1:color 255,0,0:pos 230+100,280
			mes "O"
}
if bossp=100{font "lr ",150,1:color 255,0,0:pos 230,280
			mes "B"
			font "lr ",150,1:color 255,0,0:pos 230+100,280
			mes "O"
			font "lr ",150,1:color 255,0,0:pos 230+200,280
			mes "S"
}
if bossp=150{font "lr ",150,1:color 255,0,0:pos 230,280
			mes "B"
			font "lr ",150,1:color 255,0,0:pos 230+100,280
			mes "O"
			font "lr ",150,1:color 255,0,0:pos 230+200,280
			mes "S"
			font "lr ",150,1:color 255,0,0:pos 230+300,280
			mes "S"
}
if bossp=200{ pos 0,200;ă{X̏n܂悤ɂ
			gcopy 8,0,200,800,500
			SCORE=0
			boss=1
			bossp=0
			bm=0
			bs=0.0
			pos 650,0:gcopy 8,650,0,135,50;SCORE܂
			bhp=25.0;{X̂go(25)߂Ă܂@̂Ƃ.0tȂƂ܂goo[܂
			mmplay 1;{XaflĐ
}
return
*bosshp;{X̎cgo\܂
	font "lr ",20,1:color 255,0,0:pos 0,580
			mes "BOSS"
			color 0,0,0
			boxf 50,580,800,600
			color 255,0,0
			boxf 50,580,750.0*(bhp/25)+50,600;{X̂goςƂ́Abhp/̌̐őgoɂ
return
*bmove;{X̓
	b=1 :bb=rnd(3)
	if bhp<13 and (bb=1 or bb=2):b=2;{X̂go13ႢꍇA{X񂶂ɂȂ܂
	if bm=0 {bmd=rnd(2);{X̏oĂ߂܂ 0ȂE@PȂ獶
			if bmd=0:bx=925
			if bmd=1:bx=-125
			by=100*(rnd(3)+1)+250
			ba=0;{X̍U@߂@U@͂Pp^[Ȃ̂ňӖȂł
			bm=1
}
else{if bmd=0:bx=bx-b:if bx<-125:bm=0
	if bmd=1:bx=bx+b:if bx>925:bm=0
}
if bm=1{if bmd=0:a=1
        if bmd=1:a=-1
	gsel 0
	pos bx+a*b,by
	gcopy 8,0,200,125,94
	gsel 0
	pos bx,by
	gcopy 10,bmd*125,0,125,94

}
repeat 3
	if bx<=psx(cnt)+15 and bx+125>=psx(cnt) and by<=psy(cnt)+15 and by+94>=psy(cnt){
		mci "play sen_ge_teubou_naguru02.mp3"
		pos bx,by
	    if bmd=0:gcopy 10,250,0,125,94
	    if bmd=1:gcopy 10,375,0,125,94;悤
	    gsel 0
		pos psx(cnt),psy(cnt)
		gcopy 3,0,0,15,15
		psy(cnt)=psy(cnt)+600
		pos ex1,ey1
		bhp=bhp-1
		if bhp<=0:goto*gameclear
		
		
	}
loop
return
*battack;{X̍U
if ba=0 {;eP@˕px@
	if es1=0  {est1=est1+rnd(10)
		if est1>500{ est1=0:es1=1 :esx1=bx :esy1=by+20
		mci "play spo_ge_shooting_g01.mp3"
		}}
else{
	esy1=esy1-1
	if esy1<=100{es1=0
	gsel 0
	pos esx1,esy1+1
	gcopy 3,0,0,15,15}}
if es1=1{

	gsel 0
	pos esx1,esy1+1
	gcopy 3,0,0,15,15
	gsel 0
	pos esx1,esy1
	gcopy 9,0,0,15,15
if px+10<=esx1+15 and px+140>=esx1 and py+30=esy1 :goto *gameover;G̒e̓蔻
}
if es2=0  {est2=est2+rnd(10);eQ
		if est2>1000 or( bhp<13 and  est2>500){ est2=0:es2=1 :esx2=bx+30*a*-1 :esy2=by+50;{X̂go13Ⴂꍇ,e̍UԊuZȂ܂
		mci "play spo_ge_shooting_g01.mp3"
		}}
else{
	esy2=esy2-1
	if esy2<=100{es2=0
	gsel 0
	pos esx2,esy2+1
	gcopy 3,0,0,15,15}}
if es2=1{

	gsel 0
	pos esx2,esy2+1
	gcopy 3,0,0,15,15
	gsel 0
	pos esx2,esy2
	gcopy 9,0,0,15,15
if  px+10<=esx2+15 and px+140>=esx2 and py+30=esy2 :goto *gameover
}
if es3=0  {est3=est3+rnd(10);eR
		if est3>1000  { est3=0:es3=1 :esx3=bx+60*a*-1 :esy3=by+60
		mci "play spo_ge_shooting_g01.mp3"
		}}
else{
	esy3=esy3-1
	if esy3<=100{es3=0
	gsel 0
	pos esx3,esy3+1
	gcopy 3,0,0,15,15}}
if es3=1{

	gsel 0
	pos esx3,esy3+1
	gcopy 3,0,0,15,15
	gsel 0
	pos esx3,esy3
	gcopy 9,0,0,15,15
if  px+10<=esx3+15 and px+140>=esx3 and py+30=esy3 :goto *gameover
} 
if es4=0 and by>250 {est4=est4+rnd(10);lځ@
		if est4>1000{ est4=0:es4=1 :esx4=bx+90*a*-1 :esy4=by+80
		mci "play spo_ge_shooting_g05.mp3"
		}}
else{
	esy4=esy4-2
	if esy4<=99{es4=0
	gsel 0
	pos esx4,esy4-3
	gcopy 8,esx4,esy4-3,15,20;܂eȂ̂ő傫߂ɔwiRs[Ă܂

	}}
if es4=1{

	gsel 0
	pos esx4,esy4+2
	gcopy 8,esx4,esy4+2,15,15;wỉ摜Rs[ĒexĂ܂
	gsel 0
	pos esx4,esy4
	gcopy 9,0,0,15,15
	
if  px+10<=esx4+15 and px+140>=esx4 and py+30>=esy4 :goto *gameover
} 
}
return
*gameclear
	mmstop
	mci "play muci_fan_01.mp3"
	mmplay 2
	redraw 1
	color 0,0,0
			boxf 50,580,800,600
	repeat 9
	 bbt=bbt+1 :gmode 2:pos bx,by
    if bbt=1:gcopy 7,0,0,135,120
	if bbt=3 :gcopy 7,135,0,135,120
	if bbt=5 :gcopy 7,0,130,135,120
	if bbt=7 :gcopy 7,135,130,135,120
	if bbt=9 :gcopy 8,300,300,135,120:bbt=0
	await 20
	loop
	font "lr ",70,1:color 255,255,0:pos 230,280
	mes "GAME CLEAR"
	font "lr ",50,1:pos 120,350
	mes "PUSH Space button NEXT"
	

	
	repeat
	stick key,21
	if key=0:await 10:stick key,21:if key&16 :break
	loop
	pos 0,102
	gcopy 8,0,102,800,600
	font "lr ",70,1:color 255,255,255:pos 25,100
	mes " 2014NAUCC1N1":wait 10
	font "lr ",50,1:pos 50,170
	mes {" 
	c 
	 
	Ô 
	Oc 
	 
	"}
		font "lr ",50,1:color 255,255,0:pos 120,500
	mes "PUSH Space button NEXT"
	wait 10
	
	repeat
	stick key,21
	if key=0:await 10:stick key,21:if key&16 :break
	loop
	pos 0,102
	gcopy 8,0,102,800,600
	font "lr ",70,1:color 255,255,255:pos 25,100
	mes "fޒ񋟃TCg"
	font "lr ",20:pos 40,170
	mes {"GATAGbt[CXgfޏW l
http://free-illustrations.gatag.net/
GATAGbt[CXgfޏW
Vectorartbox l

AY[RgCl
http://very.skr.jp/index.html
On-Jin `l`l
http://on-jin.com/
l
http://maoudamashii.jokersounds.com/
Senses@Circuitl
http://www.senses-circuit.com/
"}

	font "lr ",50,1:color 255,255,0:pos 120,480
	mes "PUSH Space button NEXT"
	wait 10
	
		repeat
	stick key,21
	if key=0:await 10:stick key,21:if key&16 :break
	loop
	pos 0,102
	gcopy 8,0,102,800,600
	pos 65,350
	mes "PUSH Space button NEW GAME":wait 10
	repeat
	stick key,21
	
	if key=0:await 10:stick key,21:if key&16 :mmstop:goto *start;*initialize*startɂ܂
	
	loop
*gameover
	mmstop
	mci "play 1.mp3"
	mci "play j-13.mp3"
	redraw 1
	gmode 2
	pos px,py-30
	gcopy 7,0,0,135,120:wait 5
	gcopy 7,135,0,135,120:wait 5
	gcopy 7,0,130,135,120:wait 5
	gcopy 7,135,130,135,120:wait 5
	gcopy 8,px,py-30,150,160
	pos 0,200
	gcopy 8,0,200,800,500
	font "lr ",70,1:color 255,0,0:pos 240,280
	mes "GAME OVER"
	font "lr ",50,1:pos 60,350
	mes "PUSH Space button NEW GAME"
	repeat
	stick key,21
	if key&16 :goto *start;*initialize*startɂ܂
	await 10
	loop
	;ff
//if ilive(cnt)=0{
//	ilive(cnt) = 1
//	if iii(cnt)=0 :ix(cnt) = rnd(608) :iy(cnt) = 0
//	if iii(cnt)=3 :ix(cnt) = 0 :iy(cnt) = rnd(608)
	//sp = 16
//}else{
//	if iii(cnt)=0 :iy(cnt) = iy(cnt)+sp
//	if iii(cnt)=3 :ix(cnt) = ix(cnt)+sp
	//pos ix(cnt),iy(cnt)
	//gcopy 3,0,0,32,32
	//if (ix(cnt)<0) or (ix(cnt)>640) or (iy(cnt)<0) or (iy(cnt)>640){
		//ilive(cnt) = 0
	//}
//}
