The enemy that only moves diagonally and bumps on solid objects.
I have the Autoghost code (I got it from the forums) It works, but not in rooms that have corner edges. The Anti-Fairy enemy gets stuck on them.
If you can fix it, or have a better anti-fairy script, please tell me. Thanks in advance!
ffc script AntiFairy { void run(int enemyID) { npc ghost = Ghost_InitAutoGhost(this, enemyID); if (Rand(1, 2) == 1) { Ghost_Vx = ghost->Step * 0.01; } else { Ghost_Vx = -1 * ghost->Step * 0.01; } if (Rand(1, 2) == 1) { Ghost_Vy = ghost->Step * 0.01; } else { Ghost_Vy = -1 * ghost->Step * 0.01; } while (true) { // Change X velocity when bouncing on vertical surface. if (Screen->isSolid(Ghost_X - 2, Ghost_Y + 8) || Ghost_X - 2 <= 0) { Ghost_Vx = ghost->Step * 0.01; } if (Screen->isSolid(Ghost_X + 18, Ghost_Y + 8) || Ghost_X + 18 >= 255) { Ghost_Vx = -1 * ghost->Step * 0.01; } // Change Y velocity when bouncing on horizontal surface. if (Screen->isSolid(Ghost_X + 8, Ghost_Y - 2) || Ghost_Y -2 <= 0) { Ghost_Vy = ghost->Step * 0.01; } if (Screen->isSolid(Ghost_X + 8, Ghost_Y + 18) || Ghost_Y + 18 >= 175) { Ghost_Vy = -1 * ghost->Step * 0.01; } Ghost_Waitframe(this, ghost, true, true); } } }
Edited by a30502355, 04 November 2017 - 04:32 PM.