#東方弾幕風 #Title[レッドマジックもどき] #Text[レッドマジックの練習をこれでするのは無駄です。悪しからず] #Image[] #BackGround[] #BGM[] #PlayLevel[] #Player[] #ScriptVersion[2] script_enemy_main{ let name = ""; let csd = GetCurrentScriptDirectory; let imgBoss =csd~"img\ExRumia.png"; let xIni = GetCenterX; let yIni = GetClipMinY+128; @Initialize{ CutIn(YOUMU, name, "", 0, 0, 0, 0); SetLife(2000); SetTimer(60); SetScore(20000000); SetDamageRate(5, 5); LoadGraphic(imgBoss); SetTexture(imgBoss); setGraphicStop; TMain; } @MainLoop{ yield; } @DrawLoop{ DrawGraphic(GetX,GetY); } @Finalize{ DeleteGraphic(imgBoss); } task TMain{ yield; setCollision; TRate; standBy; TShot; } task TRate{ wait(240); SetDamageRate(40,40); } sub standBy{ let wIni = 60; SetMovePosition02(xIni,yIni, wIni); setGraphicMove; SetInvincibility(wIni); wait(wIni); setGraphicPose; } task setCollision{ loop{ if(OnBomb==true){ SetAlpha(128); }else{ SetAlpha(255); SetCollisionA(GetX, GetY, 32); SetCollisionB(GetX, GetY, 16); } yield; } } task TShot{ loop{ circleShot(1, 10, GetX, GetY, 3, 0.7, RED03, 0); wait(90); moveToPlayer(rand(40,80), rand(-40,40), 60, GetClipMinX + 64, GetClipMinY + 32,GetClipMaxX - 64, GetClipMinY + 160); circleShot(1, 12, GetX, GetY, 3, 0.5, RED03, 0); wait(180); moveToPlayer(rand(40,80), rand(-40,40), 60, GetClipMinX + 64, GetClipMinY + 32,GetClipMaxX - 64, GetClipMinY + 160); circleShot(0, 10, GetX, GetY, 3, -0.7, RED03, 0); wait(90); moveToPlayer(rand(40,80), rand(-40,40), 60, GetClipMinX + 64, GetClipMinY + 32,GetClipMaxX - 64, GetClipMinY + 160); circleShot(0, 12, GetX, GetY, 3, -0.5, RED03, 0); wait(230); moveToPlayer(rand(40,80), rand(-40,40), 10, GetClipMinX + 64, GetClipMinY + 32,GetClipMaxX - 64, GetClipMinY + 160); circleShot(1, 9, GetX, GetY, 4, 0, RED03, 0); wait(20); moveToPlayer(rand(40,80), rand(-40,40), 10, GetClipMinX + 64, GetClipMinY + 32,GetClipMaxX - 64, GetClipMinY + 160); circleShot(1, 11, GetX, GetY, 4, 0, RED03, 0); wait(20); moveToPlayer(rand(40,80), rand(-40,40), 10, GetClipMinX + 64, GetClipMinY + 32,GetClipMaxX - 64, GetClipMinY + 160); circleShot(1, 14, GetX, GetY, 4, 0, RED03, 0); wait(300); } } function circleShot(n, way, x, y, speed, angleV, glf, delay){ //全方位弾 引数6 let angle = 0; loop(way){ if(n==0){ redmagic(x, y, 0, 12, speed, angle, angleV, glf, delay); angle += 360 / way; } if(n==1){ redmagic(x, y, 0, -12, speed, angle, angleV, glf, delay); angle += 360 / way; } } } task redmagic(x, y, s, sadd, speed, angle, angleV, glf, delay){ CreateShotA(0, x, y, delay); SetShotDataA(0, 0, speed, angle, angleV, 0, delay, glf); let No = 1; let n = 10; let w = 180; let v = 1.0; let s = s; loop(15){ CreateShotA(No, 0, 0, 0); SetShotDataA(No, 0, 0, angle + s, 0, 0, 0, RED01); SetShotDataA(No, w, v, NULL, 0, 0, 0, RED01); AddShot(n, 0, No, 0); n += 10; w -= 10; s += sadd; No++; } FireShot(0); } task TMove{ loop{ wait(120); moveToPlayer(rand(40,80), rand(-40,40), 60, GetClipMinX + 64, GetClipMinY + 32,GetClipMaxX - 64, GetClipMinY + 160); } } 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); setGraphicMove; wait(frame); setGraphicStop; } sub setGraphicStop { SetGraphicRect( 0, 0, 64, 64); } sub setGraphicPose { SetGraphicRect( 64, 0, 128, 64); } sub setGraphicLeft { SetGraphicRect(128, 0, 192, 64); } sub setGraphicRight { SetGraphicRect(192, 0, 256, 64); } sub setGraphicMove { if(GetSpeedX < 0) { setGraphicLeft; } else { setGraphicRight; } } function wait(w){ loop(w){yield;} } }