#東方弾幕風 #Title[サンプルスクリプト] #Text[test] #ScriptVersion[2] script_enemy_main { let imgBoss = "script\img\ExRumia.png"; let Living=true; @Initialize { SetX(GetCenterX); SetY(GetClipMinY-50); SetLife(800); LoadGraphic(imgBoss); SetTexture(imgBoss); SetGraphicRect(0, 0, 63, 63); SetMovePosition03(GetCenterX,GetCenterY-60,10,6); Shot_Main_Laser; Living_Controll; Main_Shot_Bullet; } @MainLoop { SetCollisionA(GetX, GetY, 24); SetCollisionB(GetX, GetY, 24); yield; } @DrawLoop {DrawGraphic(GetX, GetY);} @Finalize { DeleteGraphic(imgBoss); } task Objct_Laser(X,Y,Angle,Speed,Length,Width,Graphic,AutoDelete,ToItem,BombResist,SetSource) //(X座標,Y座標,角度,速度,長さ,幅,画像,画面外自動削除有無,アイテム化有無,ボム耐性有無,光源描画有無) { let Pos=0; let Obj = Obj_Create( OBJ_LASER ); Obj_SetPosition( Obj, X, Y ); Obj_SetAngle( Obj, Angle ); ObjLaser_SetLength( Obj, Length ); ObjLaser_SetWidth( Obj, Width ); ObjShot_SetGraphic( Obj, Graphic ); Obj_SetAutoDelete( Obj, AutoDelete ); ObjShot_ToItem( Obj, ToItem ); ObjShot_SetBombResist( Obj, BombResist ); ObjLaser_SetSource( Obj,SetSource); //レーザー生存フラグがtrueの場合のみ動作 while(Living) { Obj_SetPosition( Obj, X+cos(Angle)*Pos, Y+sin(Angle)*Pos ); Pos+=Speed; yield; } //レーザー生存フラグtrueではない場合の処理 //Obj_Delete( Obj ); //即消しの場合こっち ObjShot_FadeDelete( Obj ); } task Shot_Main_Laser { let Shot_Angle_Laser=90; //レーザー生存フラグがtrueの場合のみ動作 while(Living) { //レーザー発射。 Objct_Laser(GetX,GetY,Shot_Angle_Laser ,5,100,15,RED01,true,true,false,false); Objct_Laser(GetX,GetY,Shot_Angle_Laser+180,5,100,15,BLUE01,true,true,false,false); Shot_Angle_Laser+=10; loop(3){yield;} } } task Living_Controll { //レーザー生存フラグ管理 //敵ライフ400未満をスイッチにレーザー生存フラグfalse化 while(GetEnemyLife>400){yield;} Living=false; } task Main_Shot_Bullet { let Shot_Angle_Bullet=90; loop { ascent (i in 0..4) { CreateShot01(GetX,GetY,3+i*0.5,-Shot_Angle_Bullet-i*10,RED01,0); CreateShot01(GetX,GetY,3+i*0.5,-Shot_Angle_Bullet-i*10+180,BLUE01,0); } Shot_Angle_Bullet+=10; loop(3){yield;} } } }