g_actor=0;
function createAllDraw() 
	createDraw(0,"drawBehavior/vanshipBullet_normal_0.ini");
	createDraw(1,"drawBehavior/vanshipBullet_normal_1.ini");
	createDraw(2,"drawBehavior/vanshipBullet_normal_2.ini");
	createDraw(3,"drawBehavior/vanshipBullet_normal_3.ini");

	createDraw(4,"drawBehavior/vanshipBullet_flower_0.ini");
	createDraw(5,"drawBehavior/vanshipBullet_flower_1.ini");
	createDraw(6,"drawBehavior/vanshipBullet_flower_2.ini");
	createDraw(7,"drawBehavior/vanshipBullet_flower_3.ini");

	createDraw(8,"drawBehavior/vanshipBullet_laser_0.ini");
	createDraw(9,"drawBehavior/vanshipBullet_laser_1.ini");
	createDraw(10,"drawBehavior/vanshipBullet_laser_2.ini");
	createDraw(11,"drawBehavior/vanshipBullet_laser_3.ini");

	createDraw(12,"drawBehavior/vanshipEffect_powerup.ini");
	createDraw(13,"drawBehavior/vanshipEffect_bombup.ini");
	createDraw(14,"drawBehavior/vanshipEffect_lifeup.ini");

	createDraw(20,"drawBehavior/vanshipDie.ini");
	createDraw(21,"drawBehavior/bullet_effect.ini");
	createDraw(22,"drawBehavior/enemy_explorer0.ini");
	createDraw(23,"drawBehavior/enemy_explorer1.ini");

	createDraw(30,"drawBehavior/bullet/bullet0.ini");
	createDraw(31,"drawBehavior/bullet/bullet1.ini");
	createDraw(32,"drawBehavior/bullet/bullet2.ini");
	createDraw(33,"drawBehavior/bullet/bullet3.ini");
	createDraw(34,"drawBehavior/bullet/bullet4.ini");
	createDraw(35,"drawBehavior/bullet/bullet5.ini");
	createDraw(36,"drawBehavior/bullet/bullet6.ini");
	createDraw(37,"drawBehavior/bullet/bullet7.ini");
	createDraw(38,"drawBehavior/bullet/bullet8.ini");
	createDraw(39,"drawBehavior/bullet/bullet9.ini");
	createDraw(40,"drawBehavior/bullet/bullet10.ini");
	createDraw(41,"drawBehavior/bullet/bullet11.ini");
	createDraw(42,"drawBehavior/bullet/bullet12.ini");
	createDraw(43,"drawBehavior/bullet/bullet13.ini");
	createDraw(44,"drawBehavior/bullet/bullet14.ini");
	createDraw(45,"drawBehavior/bullet/bullet15.ini");
	createDraw(46,"drawBehavior/bullet/bullet16.ini");
	createDraw(47,"drawBehavior/bullet/bullet17.ini");

	createDraw(80,"drawBehavior/item/item500g.ini");
	createDraw(81,"drawBehavior/item/item1000g.ini");
	createDraw(82,"drawBehavior/item/item2000g.ini");
	createDraw(83,"drawBehavior/item/itemSmallP.ini");
	createDraw(84,"drawBehavior/item/itemBigP.ini");
	createDraw(85,"drawBehavior/item/itemBomb.ini");
	createDraw(86,"drawBehavior/item/itemLife0.ini");
	createDraw(87,"drawBehavior/item/itemLife1.ini");

	createDraw(100,"drawBehavior/enemy/enemy0.ini");
	createDraw(101,"drawBehavior/enemy/enemy1.ini");
	createDraw(102,"drawBehavior/enemy/enemy2.ini");
	createDraw(103,"drawBehavior/enemy/enemy3.ini");
	createDraw(104,"drawBehavior/enemy/enemy4.ini");
	createDraw(105,"drawBehavior/enemy/enemy5.ini");
	createDraw(106,"drawBehavior/enemy/enemy6.ini");
	createDraw(107,"drawBehavior/enemy/enemy7.ini");
	createDraw(108,"drawBehavior/enemy/enemy8.ini");
	createDraw(109,"drawBehavior/enemy/enemy9.ini");
	createDraw(110,"drawBehavior/enemy/enemy10.ini");
	createDraw(111,"drawBehavior/enemy/enemy11.ini");
	createDraw(112,"drawBehavior/enemy/enemy12.ini");
	createDraw(113,"drawBehavior/enemy/enemy13.ini");
	createDraw(114,"drawBehavior/enemy/enemy14.ini");
	createDraw(115,"drawBehavior/enemy/enemy15.ini");
	createDraw(116,"drawBehavior/enemy/enemy16.ini");
	createDraw(117,"drawBehavior/enemy/enemy17.ini");
	createDraw(118,"drawBehavior/enemy/enemy18.ini");
	createDraw(119,"drawBehavior/enemy/enemy19.ini");
	createDraw(120,"drawBehavior/enemy/enemy20.ini");
	createDraw(121,"drawBehavior/enemy/enemy21.ini");
	createDraw(122,"drawBehavior/enemy/enemy22.ini");
	createDraw(123,"drawBehavior/enemy/enemy23.ini");
	createDraw(124,"drawBehavior/enemy/enemy24.ini");
	createDraw(125,"drawBehavior/enemy/enemy25.ini");
	createDraw(126,"drawBehavior/enemy/enemy26.ini");
	createDraw(127,"drawBehavior/enemy/enemy27.ini");
	createDraw(128,"drawBehavior/enemy/enemy28.ini");
	createDraw(129,"drawBehavior/enemy/enemy29.ini");
	createDraw(130,"drawBehavior/enemy/enemy30.ini");
	createDraw(131,"drawBehavior/enemy/enemy31.ini");
	createDraw(132,"drawBehavior/enemy/enemy32.ini");
end

function createAllMove() 
	createMove(0,"MoveBehavior/vanship_burn.ini");
	
	createMove(10,"MoveBehavior/blue_mode0.ini");
	createMove(11,"MoveBehavior/blue_mode1.ini");
	createMove(12,"MoveBehavior/blue_mode2.ini");
	createMove(13,"MoveBehavior/blue_mode3.ini");
end

function createAllBp()
	createBp(0,"bp/vanship_normal.xml");

	createBp(4,"bp/vanship_flower_0.xml");
	createBp(5,"bp/vanship_flower_1.xml");
	createBp(6,"bp/vanship_flower_2.xml");
	createBp(7,"bp/vanship_flower_3.xml");	
	
	createBp(8,"bp/vanship_laser.xml");

	createBp(10,"bp/0-0.xml");
	createBp(11,"bp/0-1.xml");
	createBp(12,"bp/0-2.xml");
	createBp(13,"bp/0-3.xml");
	createBp(14,"bp/0-4.xml");

	createBp(20+3,"bp/1-3.xml");
	createBp(20+13,"bp/1-13.xml");
	createBp(20+12,"bp/1-12.xml");
	createBp(20+21,"bp/1-21.xml");
	createBp(20+25,"bp/1-25.xml");
	createBp(20+28,"bp/1-28.xml");

	createBp(60+5,"bp/3-5.xml");
	createBp(60+24,"bp/3-24.xml");
	createBp(60+29,"bp/3-29.xml");
end

function stage_createBlueMode(tick,id)
	for i=0,3 do
		setTick(tick+30*i);
		if i==3 then
			createEnemy(id+i,101,0,10+i,220-i*40,0,2);
			setEnemyDieEvent(id+i,0,22,0);
			setEnemyDieEvent(id+i,1,4,1);
		else
			createEnemy(id+i,100,0,10+i,220-i*40,0,2);
			setEnemyDieEvent(id+i,0,22,0);
		end
	end
end

function stage_createBlueMode2(tick,id)
	for i=0,3 do
		setTick(tick+30*i);
		createEnemy(id+i,100,0,10+i,220-i*40,0,2);
		setEnemyDieEvent(id+i,0,22,0);
	end
end

function stage_xLineRight(tick,id)
	for i=0,10 do
		setTick(tick+20*i)
		createEnemy(id+i,111,0,-1,440,100,10);
		setEnemySimpleMove(id+i,-1,1,-0.03,0.03);
		setEnemyDieEvent(id+i,0,22,0);
	end
end

function stage_xLineLeft(tick,id)
	for i=0,10 do
		setTick(tick+20*i)
		createEnemy(id+i,111,0,-1,0,100,10);
		setEnemySimpleMove(id+i,1,1,0.03,0.03);
		setEnemyDieEvent(id+i,0,22,0);
	end
end

function stage_blueModeFire(tick,id)
	for i=0,3 do
		setTick(tick+20*i);
		enemyFire(id+i,10,2.5,30,0,0,5,15);
	end
end

function stage_lineStrike(tick,id,num,draw,x,hp)
	for i=0,num-1 do
		setTick(tick+30*i);
		createEnemy(id+i,draw,0,-1,x,-50,hp);
		setEnemySimpleMove(id+i,0,1,0,0.015);
		setEnemyDieEvent(id+i,0,22,0);
		setEnemyDieEvent(id+i,1,1,1)
	end
end

function bossFire(time)
	for i=0,5 do
		setTick(time+i*1100)
		enemyFire(200,60+24,1,43,0,0,1,0);
		setTick(time+i*1100+360)
		enemyFire(200,60+5,1,42,0,0,1,0);
		setTick(time+i*1100+460)
		enemyFire(200,60+5,1,43,0,0,1,0);
		setTick(time+i*1100+560)
		enemyFire(200,60+5,1,47,0,0,1,0);
		setTick(time+i*1100+760)
		playEffectSound(1)
		enemyFire(200,60+29,2,43,0,0,1,0);
	end
end

function bossMove(time)
	setTick(time)
	setEnemySimpleMove(200,0,0.8,0,0);
	setTick(time+100)
	setEnemySimpleMove(200,0,0,0,0);
	setTick(time+1100)
	setEnemySimpleMove(200,-0.8,0,0,0);
	setTick(time+100+1100)
	setEnemySimpleMove(200,0,0,0,0);
	setTick(time+1100*2)
	setEnemySimpleMove(200,1.6,0,0,0);
	setTick(time+100+1100*2)
	setEnemySimpleMove(200,0,0,0,0);
	setTick(time+1100*3)
	setEnemySimpleMove(200,-0.8,-1,0,0);
	setTick(time+100+1100*3)
	setEnemySimpleMove(200,0,0,0,0);
end

function portal()
	setTick(-1)
	createAllDraw();
	createAllMove();
	createAllBp();
	loadBG("BGstage/stage1_info.ini")
	createNPC(3);
	loadOtherES(0,"sound//girlSmile.wav");
	loadOtherES(1,"sound//girlHe.wav");
	playBGM("bgm/stage1.mp3");
	
	--enemy id: 10-13
	stage_createBlueMode(80,10)
	stage_blueModeFire(150,10);
	stage_blueModeFire(300,10);
	--id:14-25
	stage_xLineRight(60,14)
	--id:26-37
	stage_xLineLeft(60,26)

	setTick(300)
	showStageTitle(1)

	--id: 38,39
	setTick(600)
	createEnemy(38,113,0,-1,112,-50,500);
	setEnemySimpleMove(38,0,1,0,0);
	setEnemyDieEvent(38,0,23,0);
	setEnemyDieEvent(38,1,1,10);
	createEnemy(39,113,0,-1,336,-50,500);
	setEnemySimpleMove(39,0,1,0,0);
	setEnemyDieEvent(39,0,23,0);
	setEnemyDieEvent(39,1,1,10);
	setTick(780)
	changeEnemyMove(38,-1);
	changeEnemyMove(39,-1);
	enemyFire(38,20+12,2,30,0,0,20,200);
	enemyFire(39,20+12,2,31,0,0,20,200);
	setTick(1400)
	setEnemySimpleMove(38,-0.5,0.5,0,0);
	setEnemySimpleMove(39,0.5,0.5,0,0);

	--40-45
	stage_lineStrike(600,40,6,111,224,10)
	--46-51
	stage_lineStrike(650,46,6,111,132,10)
	--52-57
	stage_lineStrike(650,52,6,111,316,10)
	--58-63
	stage_lineStrike(700,58,6,111,40,10)
	--64-69
	stage_lineStrike(700,64,6,111,408,10)

	--70-75
	stage_lineStrike(900,70,6,111,224,10)
	--76-81
	stage_lineStrike(950,76,6,111,132,10)
	--82-87
	stage_lineStrike(950,82,6,111,316,10)
	--88-93
	stage_lineStrike(1000,88,6,111,40,10)
	--94-99
	stage_lineStrike(1000,94,6,111,408,10)

	--id:14-25
	stage_xLineRight(1300,14)
	--id:26-37
	stage_xLineLeft(1300,26)

	--id:100
	setTick(1500)
	createEnemy(100,122,0,-1,224,-50,10000);
	setEnemySimpleMove(100,0,2,0,0);
	setTick(1600)
	beginDialog();
	if g_actor==0 then
		showDialog(-2,3,1,"已经很多年没人来这里捣乱了^你是什么人？");
		showDialog(-1,-1,0,"我是谁并不是那么重要^把理想之门交给我，我就立刻离开!");
		showDialog(-1,-1,1,"理想之门？！^呵呵，也有很多年没听到这个词了^告诉你，那东西不在这里，你放弃吧");
		showDialog(-1,-1,0,"愚蠢！^你认为我会相信你的一面之词吗？");
		showDialog(-1,-1,1,"随便你相不相信^总之捣了这么大的乱子^你是活不过今天了");
	elseif g_actor==1 then
		showDialog(-2,3,1,"已经很多年没人来这里捣乱了^你是什么人？");
		showDialog(-1,-1,0,"我不知道^我也想知道自己是谁^这里是哪儿？");
		showDialog(-1,-1,1,"在我面前装傻?");
		showDialog(-1,-1,0,"我真的什么也不知道^醒来时已经在驾驶仓里了");
		showDialog(-1,-1,1,"那不管怎么样^你今天是死定了");
	else
		showDialog(-2,3,1,"已经很多年没人来这里捣乱了^你是什么人？");
		showDialog(-1,-1,0,"组织让我来杀掉你的^你快死了，无需知道我的名字");
		showDialog(-1,-1,1,"组织？什么组织？！^为什么要杀我?");
		showDialog(-1,-1,0,"那么，我说K.Man的话^你总该明白是怎么回事了吧");
		showDialog(-1,-1,1,"哦？K.Man决定要杀我了？^但是有那么容易吗？");
	end
	endDialog();
	enemyFire(100,20+25,1.5,44,0,0,1,0);
	setEnemySimpleMove(100,0,-2,0,0);
	setTick(1630)
	enemyFire(100,20+25,2,43,0,0,1,0);
	setTick(1601)
	playEffectSound(0)
	--id:101,102
	setTick(1700)
	createEnemy(101,102,0,-1,224+120,-50,500);
	setEnemySimpleMove(101,0,0.7,0,0);
	setEnemyDieEvent(101,0,23,0);
	setEnemyDieEvent(101,1,1,20);
	createEnemy(102,102,0,-1,224-120,-50,500);
	setEnemySimpleMove(102,0,0.7,0,0);
	setEnemyDieEvent(102,0,23,0);
	setEnemyDieEvent(102,1,1,20);
	setTick(1870)
	enemyFire(101,20+28,1,43,0,0,1,0);
	enemyFire(102,20+28,1,43,0,0,1,0);

	--40-45
	stage_lineStrike(1900,40,6,111,224,10)
	--46-51
	stage_lineStrike(1950,46,6,111,132,10)
	--52-57
	stage_lineStrike(1950,52,6,111,316,10)
	--58-63
	stage_lineStrike(2000,58,6,111,40,10)
	--64-69
	stage_lineStrike(2000,64,6,111,408,10)

	--enemy id: 10-13
	stage_createBlueMode2(2200,10)
	stage_blueModeFire(2300,10);

	--id:14-25
	stage_xLineRight(2500,14)
	--id:26-37
	stage_xLineLeft(2500,26)

	--enemy id: 38
	setTick(2500)
	createEnemy(38,114,0,-1,224,-50,1000);
	setEnemySimpleMove(38,0,1,0,0);
	setEnemyDieEvent(38,0,23,0);
	setEnemyDieEvent(38,1,2,30);
	setEnemyAssHp(38);
	setTick(2700)
	setEnemySimpleMove(38,0,0,0,0);
	enemyFire(38,20+21,1,35,0,50,1,0);
	enemyFire(38,20+21,1,35,-90,-10,1,0);
	enemyFire(38,20+21,1,35,90,-10,1,0);
	setTick(3800)
	setEnemySimpleMove(38,0,-1,0,0);

	--id: 39-47
	setTick(2700)
	for i=0,4 do
		createEnemy(39+i,131,0,-1,170+40*i,-50,200);
		setEnemySimpleMove(39+i,0,0.64,0,0);
		setEnemyDieEvent(39+i,0,22,0);
	end
	setTick(2800)
	for i=0,4 do
		createEnemy(44+i,131,0,-1,170+40*i,-50,200);
		setEnemySimpleMove(44+i,0,0.64,0,0);
		setEnemyDieEvent(44+i,0,22,0);
	end

	--id: 100-102
	setTick(3180)
	for i=0,2 do
		createEnemy(100+i,132,0,-1,70+60*i,-50,200);
		setEnemySimpleMove(100+i,0,0.64,0,0);
		setEnemyDieEvent(100+i,0,22,0);
	end
	setTick(3200)
	for i=0,2 do
		enemyFire(100+i,11,2,34,0,40,5,120);
	end

	--id:14-25
	stage_xLineRight(3200,14)
	--id:26-37
	stage_xLineLeft(3200,26)

	--id:10-13
	stage_createBlueMode(3600,10)
	stage_blueModeFire(3680,10);
	stage_blueModeFire(3730,10);

	--140-145
	stage_lineStrike(3700,140,6,111,224,10)
	--146-151
	stage_lineStrike(3750,146,6,111,132,10)
	--152-157
	stage_lineStrike(3750,152,6,111,316,10)
	--158-163
	stage_lineStrike(3800,158,6,111,40,10)
	--164-169
	stage_lineStrike(3800,164,6,111,408,10)

	--id:200
	setTick(4300)
	createEnemy(200,122,0,-1,224,-50,6000);
	setEnemySimpleMove(200,0,2,0,0);
	setEnemyAssHp(200);
	setEnemyDieEvent(200,1,2,80);
	setEnemyDieEvent(200,3,0,0);
	setTick(4380)
	beginDialog();
	if g_actor==0 then
		showDialog(-2,3,1,"你到底想干什么？！^我说过，理想之门早就不在这里！^你要为你的行为付出代价！！！");
		showDialog(-1,-1,0,"这么说^你还是不肯把理想之门交出来对吧^");
		showDialog(-1,-1,1,"你的态度激怒了我!^今天这片海洋将会成为你的葬身之地!");
		showDialog(-1,-1,0,"对了^顺便告诉你个消息^你们VW总部已经陷落了^你们的精神领袖K.Man已经死了");
		showDialog(-1,-1,1,"什么！？^你们究竟干了些什么？！^杀了K.Man世界会崩溃的！！");
		showDialog(-1,-1,0,"崩溃！？");
		showDialog(-1,-1,1,"不会的!K.Man是不会死去的^相反，这个世界已经到了末日^愚蠢的人类，战斗吧！");
	elseif g_actor==1 then
		showDialog(-2,3,1,"还是不肯说出自己是谁吗?");
		showDialog(-1,-1,0,"隐隐约约想起来了一些^我们以前曾经见过吗？^我总觉得认识你");
		showDialog(-1,-1,1,"认识我？！^这世界上认识我的人太多了");
		showDialog(-1,-1,0,"我们都来自一个很远的地方对吧？");
		showDialog(-1,-1,1,"什么意思？^你到底是谁，你还知道什么？");
		showDialog(-1,-1,0,"理想之门^那里有我想要的答案^你见过那东西吗？");
		showDialog(-1,-1,1,"那里没有答案^我知道那东西，我知道你是谁了^所以，你一定要死");
	else
		showDialog(-2,3,1,"可恶，你还没死！");
		showDialog(-1,-1,0,"你在这里躲了很多年吧^哈哈，可怜的老鼠^组织已经决定彻底抛弃你了");
		showDialog(-1,-1,1,"你们都会后悔的^这么多年来，我学会保护自己了");
		showDialog(-1,-1,0,"哦？^那就让我见识见识吧");
		showDialog(-1,-1,1,"弹幕全开!!!");
		showDialog(-1,-1,0,"可怜的孩子");
		showDialog(-1,-1,1,"嘿嘿嘿，如果你杀了我^地球也会随之毁灭的!!");
	end
	endDialog();
	playBGM("bgm/stage1boss.mp3");
	setEnemySimpleMove(200,0,0,0,0);
	
	setTick(4381)
	playEffectSound(0)

	bossFire(4380);
	bossMove(4380+1560);

	--enemy id: 10-13
	stage_createBlueMode(7000,10)

	setTick(3400+4380+1560+1560)
	passStage();
end

