I decided to scrap my original idea for the Fate spellcard, and now I have this:
#TouhouDanmakufu
#Title[Reflection of a Fate Broken with Scarlet]
#Text[]
#Image[]
#BackGround[Default]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main
{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let BossImage = GetCurrentScriptDirectory ~ "boss_remilia.png";
let BossCutIn = GetCurrentScriptDirectory ~ "Remilia.png";
let frame = -100;
let frame2 = -100;
let anim_frame = 0;
let Angle = 0;
let ShotSFX = "script\sfx\shot.wav";
let LaserSFX = "script\sfx\laser.wav";
let Fate = [];
let Fate2 = [];
let Break = [];
let Angle2 = 0;
task ReflectingFate
{
let i = 0;
while (i < length(Fate))
{
if (Obj_BeDeleted(Fate[i]))
{
Fate = erase(Fate, i);
i--;
}
else
{
if(Obj_GetX(Fate[i]) <= GetClipMinX() || Obj_GetX(Fate[i]) >= GetClipMaxX())
{
Obj_SetAngle(Fate[i], 180-Obj_GetAngle(Fate[i]));
}
if(Obj_GetY(Fate[i]) <= GetClipMinY() || Obj_GetY(Fate[i]) >= GetClipMaxY())
{
Obj_SetAngle(Fate[i], 360-Obj_GetAngle(Fate[i]));
}
let e = 0;
while(e < length(Break) && !Obj_BeDeleted(Fate[i]))
{
if(Collision_Obj_Obj(Fate[i], Break[e]) == true)
{
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, Obj_GetX(Fate[i]), Obj_GetY(Fate[i]));
Obj_SetAngle(obj, (Obj_GetAngle(Fate[i]) + 360) + 45);
Obj_SetSpeed(obj, 2);
ObjShot_SetGraphic(obj, AQUA05);
Fate2 = Fate2 ~ [obj];
let obj2 = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj2, Obj_GetX(Fate[i]), Obj_GetY(Fate[i]));
Obj_SetAngle(obj2, (Obj_GetAngle(Fate[i]) + 360) - 45);
Obj_SetSpeed(obj2, 2);
ObjShot_SetGraphic(obj2, AQUA05);
Fate2 = Fate2 ~ [obj2];
Obj_Delete(Fate[i]);
}
e++;
}
}
i++;
}
}
task BrokenFate
{
let h = 0;
while (h < length(Fate2))
{
if (Obj_BeDeleted(Fate2[h]))
{
Fate2 = erase(Fate2, h);
h--;
}
else
{
if(Obj_GetY(Fate2[h]) <= GetClipMinY())
{
Obj_SetAngle(Fate2[h], 360-Obj_GetAngle(Fate2[h]));
}
let e = 0;
while(e < length(Break) && !Obj_BeDeleted(Fate2[h]))
{
if(Collision_Obj_Obj(Fate2[h], Break[e]) == true)
{
Obj_SetAngle(Fate2[h], 180-Obj_GetAngle(Fate2[h]));
}
e++;
}
}
h++;
}
}
@Initialize
{
shotinit;
LoadGraphic(BossImage);
SetLife(400);
SetDamageRate(0,0);
SetTimer(72);
SetDurableSpellCard();
CutIn(YOUMU, "Reflection of a Fate Broken with Scarlet", BossCutIn, 0, 0, 256, 320);
SetScore(70000);
SetEnemyMarker(true);
MagicCircle(true);
SetMovePosition02(GetCenterX,130,30);
}
@MainLoop
{
ReflectingFate;
BrokenFate;
anim_frame++;
SetCollisionB(GetX(),GetY(),24);
if(frame == 0)
{
loop(8)
{
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, GetX, GetY);
Obj_SetAngle(obj, Angle);
Obj_SetSpeed(obj, 2);
ObjShot_SetGraphic(obj, AQUA04);
Fate = Fate ~ [obj];
Angle += 45;
}
Angle += 22.5;
frame = -100;
}
if(frame2 >= 60 && frame2 < 100)
{
if(frame2%5 == 0)
{
loop(8)
{
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, GetX, GetY);
Obj_SetAngle(obj, Angle2);
Obj_SetSpeed(obj, 4);
ObjShot_SetGraphic(obj, RED32);
Break = Break ~ [obj];
Angle2 += 45;
}
Angle2 += 22.5;
//PlaySE(LaserSFX);
}
}
if(frame2 >= 100)
{
frame2 -= 100;
}
frame++;
frame2++;
}
@DrawLoop
{
SetTexture(BossImage);
if(anim_frame >= 0 && anim_frame < 8)
{
if(GetSpeedX()==0)
{
SetGraphicRect(31,31,95,94);
}
else if(GetSpeedX()>0)
{
SetGraphicRect(286,415,352,478);
}
else if(GetSpeedX()<0)
{
SetGraphicRect(286,159,348,222);
}
}
if(anim_frame >= 8 && anim_frame < 16)
{
if(GetSpeedX()==0)
{
SetGraphicRect(31,159,95,222);
}
else if(GetSpeedX()>0)
{
SetGraphicRect(286,415,352,478);
}
else if(GetSpeedX()<0)
{
SetGraphicRect(286,159,348,222);
}
}
if(anim_frame >= 16 && anim_frame < 24)
{
if(GetSpeedX()==0)
{
SetGraphicRect(31,287,95,350);
}
else if(GetSpeedX()>0)
{
SetGraphicRect(286,415,352,478);
}
else if(GetSpeedX()<0)
{
SetGraphicRect(286,159,348,222);
}
}
if(anim_frame >= 24 && anim_frame < 32)
{
if(GetSpeedX()==0)
{
SetGraphicRect(31,415,95,478);
}
else if(GetSpeedX()>0)
{
SetGraphicRect(286,415,352,478);
}
else if(GetSpeedX()<0)
{
SetGraphicRect(286,159,348,222);
}
}
if(anim_frame >= 32)
{
anim_frame = 0;
}
DrawGraphic(GetX, GetY);
}
@Finalize
{
DeleteGraphic(BossImage);
}
}
Of course, I wouldn't be posting here if I didn't have a problem... The problem is that while everything works as I want them to, EVERYTHING SLOWS DOWN SO MUCH. I have no idea why... Is it solely because of the tasks? Or what? I just can't tell.