ScarletBlackMarket/script/default_system/Default_Background_IceMount...

137 lines
5.1 KiB
Plaintext
Raw Permalink Normal View History

2022-08-20 05:42:00 +00:00
<EFBFBD><EFBFBD>
let bSpell = false;
let current = GetCurrentScriptDirectory();
@Initialize
{
SetCameraFocusX(0);
SetCameraFocusY(0);
SetCameraFocusZ(0);
SetCameraRadius(550);
SetCameraElevationAngle(35);
SetCameraAzimuthAngle(90);
SetFogParam(0, 1000, 32, 32, 32);
ascent(let pos in 0..3)
{
TNormalBackground(pos);
}
TSpellBackground();
}
@MainLoop
{
let objScene = GetEnemyBossSceneObjectID();
if(objScene != ID_INVALID && ObjEnemyBossScene_GetInfo(objScene, INFO_IS_SPELL))
{
bSpell = true;
}
else
{
bSpell = false;
}
yield;
}
task TNormalBackground(pos)
{
let pz = (pos-1) * 1000;
let path = current ~ "img/Default_Background_IceMountain.mqo";
let obj = ObjMesh_Create();
ObjMesh_Load(obj, path);
Obj_SetRenderPriorityI(obj, 20);
let frameInvisible = 0;
loop
{
if(bSpell)
{
frameInvisible++;
if(frameInvisible >= 60)
{
Obj_SetVisible(obj, false);
}
}
else
{
frameInvisible = 0;
Obj_SetVisible(obj, true);
}
ObjRender_SetZ(obj, pz);
pz++;
if(pz > 1000){pz -= 3000;}
yield;
}
}
task TSpellBackground
{
let path1 = current ~ "img/Default_Background_IceMountain_Spell01.png";
let obj1 = ObjPrim_Create(OBJ_SPRITE_2D);
ObjRender_SetBlendType(obj1, BLEND_ALPHA);
Obj_SetRenderPriority(obj1, 0.21);
ObjPrim_SetTexture(obj1, path1);
ObjSprite2D_SetDestRect(obj1, 0, 0, 384, 448);
let path2 = current ~ "img/Default_Background_IceMountain_Spell02.png";
let obj2 = ObjPrim_Create(OBJ_SPRITE_2D);
ObjRender_SetBlendType(obj2, BLEND_ADD_RGB);
Obj_SetRenderPriority(obj2, 0.21);
ObjPrim_SetTexture(obj2, path2);
ObjSprite2D_SetDestRect(obj2, 0, 0, 384, 448);
let u1 = 0;
let v1 = 0;
let u2 = 0;
let v2 = 0;
let su2 = rand(0.25, 1);
let sv2 = rand(0.25, 1);
let alpha = 0;
let frame = 0;
loop
{
if(bSpell)
{
alpha += 4;
}
else
{
alpha = 0;
}
v1 -= 1;
if(v1 < 256){v1+=256;}
u2 += su2;
if((su2 > 0 && u2 > 256) || (su2 < 0 && u2 < -256))
{
u2=0;
su2 = rand(0.25, 1);
if(rand(0, 1) < 0.5){su2 *= -1;}
}
v2 += sv2;
if((sv2 > 0 && v2 > 256) || (sv2 < 0 && v2 < -256))
{
v2 = 0;
sv2 = rand(0.25, 1);
if(rand(0, 1) < 0.5){sv2 *= -1;}
}
ObjRender_SetAlpha(obj1, alpha);
Obj_SetVisible(obj1, alpha > 0);
ObjSprite2D_SetSourceRect(obj1, u1, v1, u1 + 255, v1 + 255);
ObjRender_SetColor(obj2, alpha, alpha, alpha);
Obj_SetVisible(obj2, alpha > 0);
ObjSprite2D_SetSourceRect(obj2, u2, v2, u2 + 255, v2 + 255);
frame++;
yield;
}
}