ScarletBlackMarket/script/ExRumia/ExRumia01.txt

120 lines
5.1 KiB
Plaintext

//Exルーミア通常弾幕1
#include"script/default_system/Default_ShotConst.txt"
#include"script/default_system/Default_Effect.txt"
let objEnemy;
@Initialize
{
objEnemy = ObjEnemy_Create(OBJ_ENEMY_BOSS);
ObjEnemy_Regist(objEnemy);
TWork;
TRender;
TEnd;
DeleteShotAll(TYPE_ALL, TYPE_ITEM);//出現と同時に敵弾を全て削除
}
@MainLoop
{
yield;
}
@Event
{
alternative(GetEventType())
case(EV_REQUEST_LIFE)
{
SetScriptResult(1500);//ライフを1500に設定
}
case(EV_REQUEST_TIMER)
{
SetScriptResult(60);//時間制限を60秒に設定
}
}
//----------------------------------------------------
//敵動作
//----------------------------------------------------
task TWork
{
//座標(cx, 60)へ60フレームかけて移動する
let cx = GetStgFrameWidth() / 2;//STGシーンの中心x座標を取得
ObjMove_SetDestAtFrame(objEnemy, cx, 60, 60);
loop(60){yield;}
let frame = 0;
while(!Obj_IsDeleted(objEnemy))
{
let ex = ObjMove_GetX(objEnemy);
let ey = ObjMove_GetY(objEnemy);
if(frame % 8 == 0)
{
let i=0;
while(i<360)
{
CreateShotA2(ex, ey, 7, i+frame,-0.4,4,DS_RICE_S_BLUE, 0);//弾を発射
CreateShotA2(ex, ey, 5, i-frame,-0.4,3,DS_RICE_S_RED, 0);
i+=30;
}
}
if(frame == 90)
{
let px = GetPlayerX();
ObjMove_SetDestAtFrame(objEnemy, px + rand(-50, 50), rand(20, 50), 60);
}
if(frame == 150){frame = 29;};
ObjEnemy_SetIntersectionCircleToShot(objEnemy, ex, ey, 32);//当たり判定(自弾)登録
ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, ex, ey, 24);//当たり判定(体当たり)登録
frame++;
yield;
}
}
//----------------------------------------------------
//描画タスク
//----------------------------------------------------
task TRender
{
let imgExRumia = GetCurrentScriptDirectory~"ExRumia.png";
ObjPrim_SetTexture(objEnemy, imgExRumia);
while(!Obj_IsDeleted(objEnemy))
{
let angle = ObjMove_GetAngle(objEnemy);
let speed = ObjMove_GetSpeed(objEnemy);
if(speed == 0){ObjSprite2D_SetSourceRect(objEnemy, 64, 1, 127, 64);}
else if(cos(angle) > 0){ObjSprite2D_SetSourceRect(objEnemy, 192, 1, 255, 64);}
else if(cos(angle) < 0){ObjSprite2D_SetSourceRect(objEnemy, 128 ,1, 191, 64);}
ObjSprite2D_SetDestCenter(objEnemy);
yield;
}
}
//----------------------------------------------------
//終了待機タスク
//----------------------------------------------------
task TEnd
{
while(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0)
{
yield;
}
let ex = ObjMove_GetX(objEnemy);
let ey = ObjMove_GetY(objEnemy);
TExplosionA(ex, ey, 10, 0.6);
DeleteShotAll(TYPE_ALL, TYPE_ITEM);//敵弾を全て削除
Obj_Delete(objEnemy);
loop(30){yield;}
CloseScript(GetOwnScriptID());
}