I've run into a problem, where a the sprite for a ghosted enemy is somewhat mangled,and that what should be a transparent BG is displayed as another colour.
Here is a screenshot of the action, note the upper-right corner of the head with a white patch.:
Here is a tile sheet for the sprite:
Here is the script:
ffc script Ra { void run(int enemyID) { npc ghost = Ghost_InitAutoGhost(this, enemyID, GHF_IGNORE_ALL_TERRAIN); Ghost_MarkAsInUse(ghost); int amplitude = ghost->Attributes[0]; // 16 is a good number to use float period = ghost->Attributes[1]; // 64 is a good number to use int delay = ghost->Attributes[2]; // 1 is a good number to use. Higher = more jerky motion int direction = ghost->Attributes[3]; // 1 is left to right, 2 is right to left, 0 randomizes between them. I use 0. int min_restart = ghost->Attributes[4]; // minimum frames before respawning on the other side. I use 45. int max_restart = ghost->Attributes[5]; // maximum frames before respawning on the other side. I use 310. int y1; int step = ghost->Step/100; int hf = ghost->Homing; if (direction == 0) direction = Rand(1,2); while(true) { if (direction == 1) Ghost_X = -17; else if (direction == 2) Ghost_X = 256; y1 = Rand(Link->Y-(255-hf)/2, Link->Y+(255-hf)/2); // lower homing factor = less likely to spawn near Link Ghost_Y = y1; y1 = Max(48, Min(128, y1)); if(direction == 1) { while(Ghost_X <= 256 && ghost->HP > 0) { Ghost_X += step; Ghost_Y = amplitude * Sin(360*Ghost_X/period) + y1; Ghost_ForceDir(DIR_RIGHT); Ghost_Waitframes(this, ghost, true, true, delay); if (Ghost_X >= 256) { Ghost_X = -16; y1 = Rand(Link->Y-(255-hf)/2, Link->Y+(255-hf)/2); y1 = Max(0, Min(128, y1)); Ghost_Waitframes(this, ghost, true, true, Rand(min_restart,max_restart)); } } } else { while(Ghost_X >= -17 && ghost->HP > 0) { Ghost_X -= step; Ghost_Y = amplitude * Sin(360*Ghost_X/period) + y1; Ghost_ForceDir(DIR_LEFT); Ghost_Waitframes(this, ghost, true, true, delay); if (Ghost_X <= -17) { Ghost_X = 256; y1 = Rand(Link->Y-(255-hf)/2, Link->Y+(255-hf)/2); y1 = Max(0, Min(128, y1)); Ghost_Waitframes(this, ghost, true, true, Rand(min_restart,max_restart)); } } } } } }
Could anyone explain this behaviour, or a way to fix it?
The enemy otherwise works perfectly.