NarumiSTG_HyperSnowDrifter/script/KevinSystem/Default_System_MagicCircle.txt

232 lines
10 KiB
Plaintext
Raw Permalink Normal View History

2023-01-26 11:34:56 +00:00
<EFBFBD><EFBFBD>let dirCurrent = GetCurrentScriptDirectory();
let typeEnd = 0;
let END_FAILED = 1;
let END_SUCCESS = 2;
@Initialize
{
MagicCircle();
}
@MainLoop
{
yield;
}
@Event
{
alternative(GetEventType())
case(EV_END_BOSS_STEP)
{
//!kn0ue<75>R\Ox0
if(typeEnd == 0)
{
//<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>S<EFBFBD>_1YWe
typeEnd = END_FAILED;
}
}
case(EV_GAIN_SPELL)
{
//<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>S<EFBFBD>_
typeEnd = END_SUCCESS;
}
}
task MagicCircle()
{
//<02><>pGYpe<1A>vPpe<1A><>Qn0YtP0<>Qn0<6E>QtP
let countVertex = 64;
let listRadius = [];
loop(countVertex)
{
listRadius = listRadius ~ [0];
}
let path = dirCurrent ~ "img/Default_MagicCircle.png";
let obj = ObjPrim_Create(OBJ_PRIMITIVE_2D);
ObjPrim_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjPrim_SetVertexCount(obj, countVertex);
ObjRender_SetBlendType(obj, BLEND_ADD_RGB);
Obj_SetRenderPriority(obj, 0.3);
ObjPrim_SetTexture(obj, path);
ascent(iVert in 0..countVertex / 2)
{
let left = iVert * 128;
let indexVert = iVert * 2;
ObjPrim_SetVertexUVT(obj, indexVert + 0, left, 0);
ObjPrim_SetVertexUVT(obj, indexVert + 1, left, 64);
}
let objScene = GetEnemyBossSceneObjectID();
let objBoss = GetEnemyBossObjectID()[0];
let timerOrg = ObjEnemyBossScene_GetInfo(objScene, INFO_ORGTIMERF);
let bLastSpell = ObjEnemyBossScene_GetInfo(objScene, INFO_IS_LAST_SPELL);
let cx = 0;
let cy = 0;
let maxRadius = 256 * 1.2;
let alpha = 0;
let frame = 0;
let angleRender = 0;
function UpdateVertex()
{
if(bLastSpell)
{
ObjRender_SetColor(obj, 255 * alpha, 192 * alpha, 192 * alpha);
}
else
{
ObjRender_SetColor(obj, 192 * alpha, 192 * alpha, 255 * alpha);
}
ObjRender_SetPosition(obj, cx, cy, 0);
ObjRender_SetAngleZ(obj, angleRender);
}
let pathUseSpell = ObjSound_Create();
ObjSound_Load(pathUseSpell, dirCurrent ~ "se/seUseSpellCard.wav");
ObjSound_SetVolumeRate(pathUseSpell,40);
ObjSound_Play(pathUseSpell);
while(typeEnd == 0)
{
if(!Obj_IsDeleted(objBoss))
{
cx = ObjRender_GetX(objBoss);
cy = ObjRender_GetY(objBoss);
}
alpha += 1 / 120;
alpha = min(alpha, 1);
angleRender += 360 / countVertex / 4;
let timer = ObjEnemyBossScene_GetInfo(objScene, INFO_TIMERF);
let rRate = timer / timerOrg;
let bMiss = ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SHOOTDOWN_COUNT) > 0 ||
ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SPELL_COUNT) > 0 ;
ascent(iVert in 0..countVertex / 2)
{
let indexVert = iVert * 2;
let angle = 360 / (countVertex / 2 - 1) * iVert;
let vx1 = listRadius[indexVert] * cos(angle);
let vy1 = listRadius[indexVert] * sin(angle);
ObjPrim_SetVertexPosition(obj, indexVert + 0, vx1, vy1, 0);
let vx2 = listRadius[indexVert+1] * cos(angle);
let vy2 = listRadius[indexVert+1] * sin(angle);
ObjPrim_SetVertexPosition(obj, indexVert + 1, vx2, vy2, 0);
//T<><54>ec<65><63>b'Y
if(frame >= 0)
{//YtP
let dr = (maxRadius * rRate - listRadius[indexVert]) / 16;
listRadius[indexVert] = listRadius[indexVert] + dr;
}
if(frame > 45)
{//<00>QtP
let rRateIn = rRate - 0.08;
if(bMiss)
{
rRateIn = rRate - 0.04;
}
if(rRateIn < 0){rRateIn=0;}
let dr= (maxRadius * rRateIn - listRadius[indexVert + 1]) / 64;
listRadius[indexVert + 1] = listRadius[indexVert + 1] + dr;
}
}
UpdateVertex();
frame++;
yield;
}
//<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>S<EFBFBD>_1YWe
if(typeEnd == END_FAILED)
{
Obj_Delete(obj);
CloseScript(GetOwnScriptID());
return;
}
let pathGainSpell = ObjSound_Create();
ObjSound_Load(pathGainSpell, dirCurrent ~ "se/seGetSpellCardBonus.wav");
ObjSound_SetVolumeRate(pathGainSpell,40);
ObjSound_Play(pathGainSpell);
let rRate = 1.0;
frame = 0;
alpha = 1;
//<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>S<EFBFBD>_b<>R
loop(105)
{
angleRender += 360 / countVertex / 4;
let dx = (GetPlayerX() - cx) / 16;
let dy = (GetPlayerY() - cy) / 16;
cx += dx;
cy += dy;
if(frame >= 45)
{
alpha -= 1 / 45;
alpha = max(alpha, 0);
}
ascent(iVert in 0..countVertex / 2)
{
let indexVert = iVert * 2;
let angle = 360 / (countVertex / 2 - 1) * iVert;
let vx1 = listRadius[indexVert] * cos(angle);
let vy1 = listRadius[indexVert] * sin(angle);
ObjPrim_SetVertexPosition(obj, indexVert + 0, vx1, vy1, 0);
let vx2 = listRadius[indexVert+1] * cos(angle);
let vy2 = listRadius[indexVert+1] * sin(angle);
ObjPrim_SetVertexPosition(obj, indexVert + 1, vx2, vy2, 0);
let drOut = 0;
let drIn = 0;
if(frame <= 45)
{
//T<><54>ec<65><63>b'Y
let rRateOut = 1.0;
drOut = (maxRadius * rRateOut - listRadius[indexVert]) / 8;
let rRateIn = rRateOut - 0.08;
if(rRateIn<0){rRateIn=0;}
drIn = (maxRadius * rRateIn - listRadius[indexVert+1]) / 8;
}
else
{
cx = GetPlayerX();
cy = GetPlayerY();
rRate -= 1.0 / 60.0;
let rRateOut = rRate * sin(angle % 60);
drOut = (maxRadius * rRateOut - listRadius[indexVert]) / 16;
let rRateIn = rRate * sin(angle % 60)-0.08;
if(rRateIn<0){rRateIn=0;}
drIn=(maxRadius * rRateIn - listRadius[indexVert+1])/16;
}
listRadius[indexVert] = listRadius[indexVert] + drOut;
listRadius[indexVert + 1] = listRadius[indexVert + 1] + drIn;
}
UpdateVertex();
frame++;
yield;
}
Obj_Delete(obj);
CloseScript(GetOwnScriptID());
}