@InitD0("Original Tile"),
@InitDHelp0("The first of an 8x2 tile block. Both rows of tiles use the U,D,L,R,UL,UR,DL,DR ordering. The first 8 tiles face counter clockwise. The second face clockwise.")
itemdata script SwordGFX
{
void run(int OriginalTile)
{
bool FlipSlash = this->Flags[7];
int Offsets[] = {0, 0, 0, 20};
if(FlipSlash)
Offsets[DIR_RIGHT] = 0;
// Wait for the sword to exist
while(true)
{
lweapon l = LoadLWeaponOf(LW_SWORD);
if(l->isValid())
break;
Waitframe();
}
// Run until the sword stops existing
while(true)
{
lweapon l = LoadLWeaponOf(LW_SWORD);
if(l->isValid())
{
int dir = AngleDir8(Angle(Link->X, Link->Y, l->X, l->Y));
l->ScriptTile = OriginalTile+Offsets[l->Dir]+dir;
l->ScriptFlip = 0;
}
else
break;
Waitframe();
}
}
}