Cirno2022/script/sample/SampleB03.txt

86 lines
2.3 KiB
Plaintext
Raw Permalink Normal View History

#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["SampleB03"]
#Text["SampleB03: ObjPatternShot Transforms 2 : Transform Harder"]
#include "script/default_system/Default_ShotConst.txt"
let objEnemy;
let frame = 0;
@Event {
alternative(GetEventType())
case(EV_REQUEST_LIFE) {
SetScriptResult(500);
}
}
@Initialize {
objEnemy = ObjEnemy_Create(OBJ_ENEMY_BOSS);
ObjEnemy_Regist(objEnemy);
let imgExRumia = GetCurrentScriptDirectory ~ "ExRumia.png";
ObjPrim_SetTexture(objEnemy, imgExRumia);
ObjSprite2D_SetSourceRect(objEnemy, 64, 1, 127, 64);
ObjSprite2D_SetDestCenter(objEnemy);
let cx = GetStgFrameWidth() / 2;
ObjMove_SetDestAtFrame(objEnemy, cx, 120, 60);
SetPlayerInvincibilityFrame(600000);
TShot();
}
@MainLoop {
let ex = ObjMove_GetX(objEnemy);
let ey = ObjMove_GetY(objEnemy);
ObjEnemy_SetIntersectionCircleToShot(objEnemy, ex, ey, 32);
ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, ex, ey, 24);
yield;
if (ObjEnemy_GetInfo(objEnemy, INFO_LIFE) <= 0) {
Obj_Delete(objEnemy);
CloseScript(GetOwnScriptID());
return;
}
}
task TShot() {
let objPattern = ObjPatternShot_Create();
ObjPatternShot_SetParentObject(objPattern, objEnemy);
ObjPatternShot_SetPatternType(objPattern, PATTERN_RING);
ObjPatternShot_SetDelay(objPattern, 12);
ObjPatternShot_SetGraphic(objPattern, DS_BALL_S_RED);
ObjPatternShot_SetSpeed(objPattern, 2, 1.2);
ObjPatternShot_SetShotCount(objPattern, 16, 1);
ObjPatternShot_SetInitialBlendMode(objPattern, BLEND_ADD_ARGB);
ObjPatternShot_AddTransform(objPattern, TRANSFORM_WAIT, 20);
ObjPatternShot_AddTransform(objPattern, TRANSFORM_N_DECEL_CHANGE, 25, 5, 1, 2.7, 10.12); //Think of Aunn's first spell
ObjPatternShot_AddTransform(objPattern, TRANSFORM_ADDPATTERN_A1, 0, 0, NO_CHANGE);
ObjPatternShot_AddTransform(objPattern, TRANSFORM_WAIT, 60);
ObjPatternShot_AddTransform(objPattern, TRANSFORM_BLEND_CHANGE, BLEND_ALPHA);
ObjPatternShot_AddTransform(objPattern, TRANSFORM_GRAPHIC_CHANGE, DS_RICE_S_RED);
ObjPatternShot_AddTransform(objPattern, TRANSFORM_TO_SPEED_ANGLE, 60, 1.8, NO_CHANGE);
wait(60);
let frame = 0;
while (ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0) {
ObjPatternShot_SetAngle(objPattern, rand(0, 360), 0);
ObjPatternShot_SetTransform(objPattern, 1, TRANSFORM_N_DECEL_CHANGE, 25, 5, 1, 2.7, 14 * sin(frame * 6));
ObjPatternShot_Fire(objPattern);
frame++;
wait(4);
}
}