#東方弾幕風
#Title[人界剣「悟入幻想 -Easy-」]
#Text[妖々夢5面:妖夢スペルのクローン]
#ScriptVersion[2]
script_enemy_main {
let name = "人界剣「悟入幻想 -Easy-」";
let imgBoss = "script\img\ExRumia.png";
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 {
CutIn(YOUMU, name, "", 0, 0, 0, 0);
SetLife(2000);
SetTimer(66);
SetScore(4000000);
SetDamageRate(5, 5);
LoadGraphic(imgBoss);
SetTexture(imgBoss);
setGraphicStop;
TMain;
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
yield;
}
@DrawLoop {
DrawGraphic(GetX, GetY);
}
@Finalize {
DeleteGraphic(imgBoss);
}
task TMain {
yield;
standBy;
levitate;
concentration;
slash;
ready;
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;
setGraphicPose;
Concentration01(wConc);
wait(wConc);
}
sub slash {
let id = 0;
let wMove = 10;
let wStop = 60 - wMove;
let span = (xLaserBegin - xLaserEnd) / wMove;
CreateLaserA(id, xLaserBegin, yLaser, 0, 10, BLUE01, 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 ready {
let wMove = 120;
let wStop = 60;
SetMovePosition02(xStart, yStart, wMove);
setGraphicMove;
wait(wMove);
setGraphicStop;
wait(wStop);
SetDamageRate(40, 40);
}
task TShotToAir {
let wShot = 8;
loop {
CreateShot01(rand(GetClipMinX, GetClipMaxX),
yLaser, 1, rand(-92, -88), BLUE11, wShot);
wait(wShot);
}
}
sub move {
let wMove = 60;
moveToPlayer(rand(40, 80), rand(-40, 40), wMove,
GetClipMinX + 48, GetClipMinY + 32,
GetClipMaxX - 48, GetClipMinY + 128);
setGraphicMove;
wait(wMove);
}
sub shot {
let base = GetAngleToPlayer;
let angle = 36;
let nShot = 7;
let wShot = 5;
let wBefore = 60 - wShot * nShot;
let v = 1.5;
let delay = wShot * nShot;
setGraphicPose;
wait(wBefore);
loop(nShot) {
nway(v, base + 180, 6, 30, delay);
nway(v, base, 3, angle, delay);
wait(wShot);
angle += 1;
v -= 0.15;
delay -= wShot;
}
}
function nway(v, dir, way, span, delay) {
let angle = dir - (way - 1) / 2 * span;
loop(way) {
CreateShot01(GetX, GetY, v, angle, RED02, delay);
angle += span;
}
}
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, 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; }
}
}