#東方弾幕風 #Title[幻舞刀「悟入幻想-myon-」] #Text[幻舞刀「悟入幻想-myon-」] #ScriptVersion[2] #BackGround[User(.\img\eff05b.png, 0, -10)] script_enemy_main { let name = "幻舞刀「悟入幻想-myon-」"; let imgBoss = "script\みんなが本気を出すそうです\img\youmu.png"; let imgFam = "script\みんなが本気を出すそうです\img\familiar.png"; let current = GetCurrentScriptDirectory(); let seCons = current~"SE\se_cat00.wav"; let seShot = current~"SE\se_tan00音量小.wav"; let seHit = current ~ "SE\se_damage01.wav"; let seFam = current ~ "SE\se_option.wav"; let seFin = current ~ "SE\se_enep01小.wav"; let seSrs = current ~ "SE\se_slash.wav"; let seMit = current ~ "SE\se_power1.wav"; // 初期位置 let xIni = GetClipMaxX - 32; let yIni = GetClipMaxY - 32; // 横薙ぎ後の位置 let xSlash = GetClipMinX + 32; let ySlash = yIni; // 開始位置 let xStart = GetClipMinX + 48; let yStart = GetClipMinY + 96; // レーザーの設置位置 let xLaserBegin = GetClipMaxX + 32; let xLaserEnd = GetClipMinX - 32; let yLaser = GetClipMaxY - 16; @Initialize { SetLife(2000); SetTimer(66); SetScore(4000000); SetDamageRate(5, 5); SetTexture(imgBoss); LoadGraphic(imgFam); LoadGraphic(imgBoss); LoadSE( seShot ); LoadSE( seCons ); LoadSE( seHit ); LoadSE( seFin ); LoadSE( seSrs ); LoadSE( seMit ); SetTexture(imgBoss); setGraphicStop; PlaySE( seCons ); CutIn(YOUMU, name, "script\みんなが本気を出すそうです\img\face_ym00.png", 0, 0, 256, 512); TMain; } @MainLoop { SetCollisionA(GetX, GetY, 32); SetCollisionB(GetX, GetY, 16); yield; } task TMove { let angle = 0; loop { SetY(yIni + 4 * sin(angle)); yield; angle += 3; } } @DrawLoop { DrawGraphic(GetX, GetY); } @Finalize { DeleteGraphic(imgBoss); } // メインタスク task TMain { yield; standBy; levitate; concentration; slash; slash2; slash3; slash4; ready; setFam; TShotToAir; loop { move; shot; } } // 初期位置へ移動 sub standBy { let wIni = 120; SetMovePosition02(xIni, yIni, wIni); setGraphicMove; SetInvincibility(wIni); wait(wIni); } // 浮揚 sub levitate { let wLev = 60; setGraphicStop; SetMovePosition02(xIni, yIni + 10, wLev); wait(wLev); SetMovePosition02(xIni, yIni, wLev); wait(wLev); } // 力を集中 sub concentration { let wConc = 60; PlaySE( seMit ); setGraphicPose; Concentration01(wConc); wait(wConc); } // 横薙ぎ sub slash { let id = 0; let wMove = 10; let wStop = 20 - wMove; let span = (xLaserBegin - xLaserEnd) / wMove; // レーザーを延ばす間隔 PlaySE( seSrs ); CreateLaserA(id, xLaserBegin, yLaser, 10, 10, BLUE03, 0); SetLaserDataA(id, 0, 180, 0, span, 0, 0); SetLaserDataA(id, wMove, NULL, 0, 0, 0, 0); FireShot(id); SetMovePosition02(xSlash, ySlash, wMove); setGraphicMove; wait(wMove); wait(wStop); } sub slash2 { let id = 0; let wMove = 10; let wStop = 20 - wMove; let span = (xLaserBegin - xLaserEnd) / wMove; // レーザーを延ばす間隔 PlaySE( seSrs ); CreateLaserA(id, GetEnemyX, GetEnemyY, 10, 10, BLUE03, 0); SetLaserDataA(id, 0, -90, 0, span, 0, 0); SetLaserDataA(id, wMove, NULL, 0, 0, 0, 0); FireShot(id); SetMovePosition02(xSlash,70, wMove); setGraphicMove; wait(wMove); wait(wStop); } sub slash3 { let id = 0; let wMove = 10; let wStop = 20 - wMove; let span = (xLaserBegin - xLaserEnd) / wMove; // レーザーを延ばす間隔 PlaySE( seSrs ); CreateLaserA(id, GetEnemyX, GetEnemyY, 10, 10, BLUE03, 0); SetLaserDataA(id, 0,0, 0, span, 0, 0); SetLaserDataA(id, wMove, NULL, 0, 0, 0, 0); FireShot(id); SetMovePosition02( xIni,70, wMove); setGraphicMove; wait(wMove); wait(wStop); } sub slash4 { let id = 0; let wMove = 10; let wStop = 20 - wMove; let span = (xLaserBegin - xLaserEnd) / wMove; // レーザーを延ばす間隔 PlaySE( seSrs ); CreateLaserA(id, GetEnemyX, GetEnemyY, 10, 10, BLUE03, 0); SetLaserDataA(id, 0, 90, 0, span, 0, 0); SetLaserDataA(id, wMove, NULL, 0, 0, 0, 0); FireShot(id); SetMovePosition02(xIni,ySlash, wMove); setGraphicMove; wait(wMove); wait(wStop); } // 定位置へ移動して、攻撃開始 sub ready { let wMove = 120; let wStop = 60; SetMovePosition02(224,240, wMove); setGraphicMove; wait(wMove); setGraphicStop; wait(wStop); SetDamageRate(40, 40); } // 下から上へ常に発射される対空弾 task TShotToAir { let wShot = 30; // 発射間隔 loop { CreateShot01(rand(GetClipMinX, GetClipMaxX),yLaser, 1, rand(-92, -88), BLUE31, wShot); PlaySE( seShot ); wait(wShot); } } sub setFam { let seFam = current ~ "SE\se_option.wav"; // 使い魔の三角形の中心位置 // x 座標は中心からの距離になっています。 let xFamCenter = (GetCenterX - GetClipMinX) / 2; let yFamCenter = yIni; // 使い魔の位置(中心からの向き) let angleFam = [0,0,0,0]; ascent(i in 0..4) { CreateEnemyFromScript("Familiar2", GetCenterX + xFamCenter, yFamCenter, 0, angleFam[i] + 180, -1); PlaySE( seFam ); } wait(50); } // 移動 sub move { let wMove = 60; moveToPlayer(rand(40, 80), rand(-40, 40), wMove, GetClipMinX + 48, GetClipMinY + 32, GetClipMaxX - 48, GetClipMinY + 128); setGraphicMove; wait(wMove); } // way 弾を発射 sub shot { let base = GetAngleToPlayer; // 基準角 let angle = 36; // 自機狙い 3-way 弾の間隔 let nShot = 7; // 各弾を撃つ回数 let wShot = 5; // 弾を撃つ間隔 let wBefore = 60 - wShot * nShot; // 発射後に待つ時間 let v = 1.5; // 発射速度 let delay = wShot * nShot; // 発射遅延時間 setGraphicPose; wait(wBefore); loop(1) { nway(v, base + 180, 6, 30, delay); nway(v, base, 3, angle, delay); PlaySE( seShot ); wait(wShot); angle += 1; v -= 0.15; delay -= wShot; } } // n-way 弾を撃つ関数 // v : 発射速度 // dir : 弾を撃つ方向 // way : 弾の数 // span : 弾の間隔(角度) // delay : 発射遅延時間 function nway(v, dir, way, span, delay) { let angle = dir - (2 - 1) / 2 * span; // 発射角 loop(3) { CreateShot01(GetX, GetY, v, angle, RED31, 60); PlaySE( seShot ); CreateShot01(GetX, GetY, v, -angle, BLUE05, 60); PlaySE( seShot ); angle += span; } } // なるべくプレイヤーの方向に移動 // xMove : x 方向の移動量(正の数) // yAdd : y 方向の移動量 // frame : 移動に要するフレーム数 // left : 以下、可動範囲 // top : // right : // bottom : function moveToPlayer(xMove, yAdd, frame, left, top, right, bottom) { let x; let y; if(GetPlayerX < GetX) { // プレイヤーより右に敵がいれば、敵は左に動きます。 x = GetX - xMove; // 但し、敵が可動領域の左端よりも左にいくようなら、右に動きます。 if(x < left) { x = GetX + xMove; } } else { // さもなくば、敵は右に動きます。 x = GetX + xMove; // 但し、敵が可動領域の右端よりも右にいくようなら、左に動きます。 if(right < x) { x = GetX - xMove; } } // 可動領域の外に行く場合は、端っこで止めます。 y = GetY + yAdd; if(y < top) { y = top; } else if(bottom < y) { y = bottom; } SetMovePosition02(x, y, frame); } // グラフィックの設定 sub setGraphicStop { SetGraphicRect( 0, 0, 46, 64); } sub setGraphicPose { SetGraphicRect(195, 182, 239, 255); } sub setGraphicLeft { SetGraphicRect(146, 65, 190, 122); } sub setGraphicRight { SetGraphicRect(194, 65, 236, 127); } sub setGraphicMove { if(GetSpeedX < 0) { setGraphicLeft; } else { setGraphicRight; } } // w フレームだけ待つ function wait(w) { loop(w) { yield; } } } script_enemy Familiar2 { let current = GetCurrentScriptDirectory(); let seCons = current~"SE\se_cat00.wav"; let seShot = current~"SE\se_tan00音量小.wav"; let seHit = current ~ "SE\se_damage01.wav"; // 使い魔の中心位置 let xCenter = GetEnemyX; let yCenter = GetEnemyY; // 中心位置からの距離と角度 // 実際の角度は angBase + angle になります。 let r = 10; let angBase = GetAngle; let angle = 0; // 移動方向(±1) let dir = GetArgument; @Initialize { SetLife(2000); SetScore(10000); SetDamageRateEx(50, 50, 25, 25); SetTexture(imgFam); LoadSE( seShot ); LoadSE( seCons ); LoadSE( seHit ); setGraphicFast; TMain; } @MainLoop { let current = GetCurrentScriptDirectory(); let seShot = current~"SE\se_tan00音量小.wav"; let seHit = current ~ "SE\se_damage01.wav"; let frame = 0; let angleBase = 10; if(GetKeyState(VK_SLOWMOVE) == KEY_HOLD) { setGraphicSlow; } else { SetCollisionA(GetEnemyX+90,GetEnemyY+90, 32); setGraphicFast; } yield; } @DrawLoop { DrawGraphic(GetEnemyX+90,GetEnemyY+90); DrawGraphic(GetEnemyX-90,GetEnemyY-90); DrawGraphic(GetEnemyX+90,GetEnemyY-90); DrawGraphic(GetEnemyX-90,GetEnemyY+90); } task TMain { yield; standBy; TMove; TShot; } // 初期位置へ移動 sub standBy { let dr = 32 / wSetFam; // 動径方向の速度 let w = 210 / wSetFam; // 角速度 loop(wSetFam) { r += dr; move(w); yield; } } // 移動 task TMove { wait(45); loop { move(0.77); yield; } } // 三角形の中心に向かって攻撃 task TShot { let current = GetCurrentScriptDirectory(); let seShot = current~"SE\se_tan00音量小.wav"; let seHit = current ~ "SE\se_damage01.wav"; let frame = 0; let angleBase = 10; loop{ frame++; if(frame == 10) { let angle = angleBase - 10; loop(40) { CreateShot01(GetX, GetY, 1, angle, WHITE04, 0); PlaySE( seShot ); angle += 100; yield; } angleBase += 8; }else if(frame == 11) { let angle = angleBase - 10; loop(40) { CreateShot01(GetX, GetY, 1, -angle, WHITE04, 0); PlaySE( seShot ); angle += 100; yield; } angleBase += 8; } yield; } } // 次の位置へ移動 // w : 角速度 function move(w) { angle += w * dir; SetX(xCenter + r * cos(angBase + angle)); SetY(yCenter + r * sin(angBase + angle)); SetGraphicAngle(0, 0, angle); // グラフィックを傾けます } // グラフィックの設定 sub setGraphicFast { SetGraphicRect( 0, 0, 48, 48); } sub setGraphicSlow { SetGraphicRect( 0, 48, 48, 96); } #include_function ".\使い魔.h.txt" }