#東方弾幕風 #Title[背理「輪廻途絶」] #Text[] #Image[] #BackGround[] #ScriptVersion[2] script_enemy_main { #include_function ".\lib\lib_anime_Mokou.txt" let img_mokou = GetCurrentScriptDirectory~"img\dot_mokou.png"; let csd = GetCurrentScriptDirectory; let shotData = csd ~ "data_usershot.txt"; let imgEffect= csd~"\img\shot_all.png"; let px = []; let py = []; @Initialize() { InitializeAction(); SetLife(2000);//敵のライフを2000に設定 SetDamageRate(45, 30); SetScore(400000); SetTimer(99); CutIn(YOUMU ,"背理「輪廻途絶」" ,csd ~ "" ,0 ,0 ,0 ,0); LoadGraphic(img_mokou);//画像「img\ExRumia.png」を読みこむ LoadGraphic(imgEffect); LoadUserShotData(shotData); Tmain; } @MainLoop() { SetCollisionA(GetX(),GetY(),32);//敵の座標に当たり判定を登録 SetCollisionB(GetX(),GetY(),24);//敵の座標に当たり判定(体当たり用)を登録 yield;//毎フレームタスク復帰 } @DrawLoop() { DrawBoss(img_mokou);//敵の座標にExルーミアを描画; } @Finalize() { DeleteGraphic(img_mokou); } //------------------------------------------------------- //親メインタスク task Tmain { standby; Concentration01(60); SetAction(ACT_CHARGE ,50); wait(60); SetAction(ACT_SHOT_B ,50); Tring; } task Tring { let i = 1; loop { let ang = 0; while(ang < 360) { Tring_shot(ang ,9 ,i); ang += 360/10; } wait(250); i ++; } } task Tring_shot(ang ,grp ,i) { //輪の構成要素 let spd = 1.5; let del = 30; let r = 40;//弾出現位置の半径 let x = r *cos(ang); let y = r *sin(ang); let time_round = 120; let count = 1; //回転弾 let obj1 = Obj_Create(OBJ_SHOT); ObjShot_SetDelay(obj1 ,del); Obj_SetAngle(obj1 ,ang +180); ObjShot_SetGraphic(obj1 ,grp); //ディレイ中に弾移動 loop(del) { Obj_SetPosition(obj1 ,GetPlayerX() +x ,GetPlayerY() +y); wait(1); } px = px ~[GetPlayerX()]; py = py ~[GetPlayerY()]; //収束 while(spd > 0) { Obj_SetSpeed(obj1 ,spd); spd -= 0.05; wait(1); } wait(30); Obj_SetAngle(obj1 ,ang +60); let frame = time_round +50; //回転加速 loop(time_round) { Obj_SetSpeed(obj1 ,spd); Obj_SetAngle(obj1 ,ang); spd += 0.05; ang += 3; //弾追加 if(count > 25 && count %10 == 0) { Taddshot(Obj_GetX(obj1) ,Obj_GetY(obj1) ,frame ,grp ,i); } frame --; count ++; wait(1); } //停止 Obj_SetSpeed(obj1 ,0); wait(80); ang = atan2(py[i] - Obj_GetY(obj1) ,px[i] -Obj_GetX(obj1)); let l = ((px[i] -Obj_GetX(obj1))^2 + (py[i] -Obj_GetY(obj1))^2)^(1/2); let frame_cnv = 30;//収束にかかるフレーム //収束 Obj_SetAngle(obj1 ,ang); Obj_SetSpeed(obj1 ,l/frame_cnv); wait(frame_cnv); Obj_Delete(obj1); } //追加弾 task Taddshot(x ,y ,frame ,grp ,i) { let spd = 1; let obj2 = Obj_Create(OBJ_SHOT); Obj_SetPosition(obj2 ,x ,y); ObjShot_SetDelay(obj2 ,10); ObjShot_SetGraphic(obj2 ,grp); Obj_SetSpeed(obj2 ,spd); Obj_SetAngle(obj2 ,rand(0,360)); wait(10);//delay while(spd > 0) { spd -= 0.05; Obj_SetSpeed(obj2 ,spd); wait(1); } wait(frame); ObjShot_SetGraphic(obj2 ,16); let ang = atan2(py[i] - Obj_GetY(obj2) ,px[i] -Obj_GetX(obj2)); let l = ((px[i] -Obj_GetX(obj2))^2 + (py[i] -Obj_GetY(obj2))^2)^(1/2); let frame_cnv = 30;//収束にかかるフレーム //収束 Obj_SetAngle(obj2 ,ang); Obj_SetSpeed(obj2 ,l/frame_cnv); wait(frame_cnv); Obj_Delete(obj2); } // 初期位置へ移動 sub standby { let wIni = 120; SetMovePosition02(GetCenterX, GetClipMinY+120, wIni); SetInvincibility(wIni); wait(wIni); } sub move { if(GetX() >= GetPlayerX()) {move_left;} if(GetX() < GetPlayerX()) {move_right;} } sub move_left { if(GetX() < GetClipMinX() +120) {//移動限界判定 return; } SetMovePosition03(GetX() -50 ,GetClipMinY() +120 +rand(20,-20) ,10 ,1); SetAction(ACT_MOVE_L ,50); } sub move_right { if(GetX() > GetClipMaxX() -120) {//移動限界判定 return; } SetMovePosition03(GetX() +50 ,GetClipMinY() +120 +rand(20,-20) ,10 ,1); SetAction(ACT_MOVE_R ,50); } // グラフィックの設定 sub setGraphicStop { SetAction(ACT_STAND ,50); } sub setGraphicPose { SetAction(ACT_STAND ,50); } sub setGraphicLeft { SetAction(ACT_MOVE_L ,50); } sub setGraphicRight { SetAction(ACT_MOVE_R ,50); } sub setGraphicMove { if(GetSpeedX < 0) { setGraphicLeft; } else if(GetSpeedX > 0){ setGraphicRight; } else if(GetSpeedY > 0 || GetSpeedY < 0){ setGraphicStop; } else if(GetSpeedY == 0){ setGraphicPose; } } // w フレームだけ待つ function wait(w) { loop(w) { yield; } } }