static void lookForPlayer() { int frame; float timer; if (self->active == TRUE) { self->flags &= ~NO_DRAW; moveLeftToRight(); if (self->currentFrame == 3) { if (self->health == 0) { playSoundToMap("sound/enemy/gazer/flap", -1, self->x, self->y, 0); self->health = 1; } } else { self->health = 0; } if (player.health > 0 && player.alpha == 255 && collision(self->x + self->w / 2 - 10, self->y, 20, self->endY, player.x, player.y, player.w, player.h) == 1) { playSoundToMap("sound/enemy/gazer/growl", -1, self->x, self->y, 0); setInfoBoxMessage(120, 255, 255, 255, _("INTRUDER!")); self->thinkTime = 300; activateEntitiesWithRequiredName(self->objectiveName, FALSE); if (self->mental == 1) { summonEnemies(); } frame = self->currentFrame; timer = self->frameTimer; setEntityAnimation(self, "ATTACK_1"); self->currentFrame = frame; self->frameTimer = timer; self->target = &player; self->action = &followPlayer; } } else { self->flags |= NO_DRAW; } }
static void move() { moveLeftToRight(); if (onSingleTile(self) == TRUE) { self->action = &moveReckless; } }
static void headMove() { int currentFrame, health; if (self->mental >= 2) { self->thinkTime--; if (self->thinkTime <= 300) { if (self->thinkTime % 15 == 0) { currentFrame = self->currentFrame; if (self->mental < 4) { setEntityAnimation(self, self->mental == 2 ? "CUSTOM_1" : "CUSTOM_2"); self->mental = self->mental == 2 ? 4 : 5; } else { setEntityAnimation(self, "STAND"); self->mental = self->mental == 4 ? 2 : 3; } self->currentFrame = currentFrame; } if (self->thinkTime <= 0) { currentFrame = self->currentFrame; health = self->health; loadProperties(self->mental % 2 == 0 ? "enemy/yellow_centipede" : "enemy/red_centipede", self); self->health = health; self->mental = self->mental % 2; self->touch = &touch; self->currentFrame = currentFrame; } } } moveLeftToRight(); }
static void move() { moveLeftToRight(); hover(); self->health--; if (self->health <= 0) { playSoundToMap("sound/enemy/ghost/ghost", -1, self->x, self->y, 0); self->health = (6 + prand() % 10) * 60; } self->box.h = self->endY - self->y; }
static void walkAround() { int face = self->face; self->thinkTime--; if (self->thinkTime <= 0) { self->dirX = 0; self->thinkTime = 30; self->dirY = -3; self->action = &flyStart; self->flags |= FLY; setEntityAnimation(self, "STAND"); self->mental = 3; playSoundToMap("sound/enemy/bug/buzz", -1, self->x, self->y, 0); } else { moveLeftToRight(); if (self->face != face) { self->endX++; if (self->endX >= 15) { self->thinkTime = 0; } } } }
static void walk() { moveLeftToRight(); self->thinkTime--; if (self->thinkTime <= 0) { self->dirX = 0; if (prand() % 5 == 0) { self->action = &changeWalkDirectionStart; } else { self->thinkTime = 60; self->action = &electrifyStart; } } }
static void lookForPlayer() { moveLeftToRight(); self->thinkTime--; if (player.health > 0 && self->thinkTime <= 0) { /* Must be within a certain range */ if (collision(self->x + (self->face == LEFT ? -100 : self->w + 64), self->y, 36, self->h, player.x, player.y, player.w, player.h) == 1) { self->dirX = 0; self->thinkTime = 60; self->action = &biteWait; self->mental = 1; playSoundToMap("sound/enemy/mouth_stalk/hiss", -1, self->x, self->y, 0); } } }
static void closedEyeMove() { int frame; float timer; moveLeftToRight(); if (self->currentFrame == 3) { if (self->health == 0) { playSoundToMap("sound/enemy/gazer/flap", -1, self->x, self->y, 0); self->health = 1; } } else { self->health = 0; } self->thinkTime--; if (self->thinkTime <= 0) { self->mental = 1 - self->mental; frame = self->currentFrame; timer = self->frameTimer; setEntityAnimation(self, self->mental == 0 ? "STAND" : "WALK"); self->currentFrame = frame; self->frameTimer = timer; self->thinkTime = self->maxThinkTime; } if (player.health > 0 && self->mental == 0 && collision(self->x + self->w / 2 - 10, self->y, 20, self->endY, player.x, player.y, player.w, player.h) == 1) { playSoundToMap("sound/enemy/gazer/growl", -1, self->x, self->y, 0); setInfoBoxMessage(120, 255, 255, 255, _("INTRUDER!")); self->thinkTime = 300; activateEntitiesWithRequiredName(self->objectiveName, FALSE); if (self->damage == 1) { summonEnemies(); } frame = self->currentFrame; timer = self->frameTimer; setEntityAnimation(self, "ATTACK_1"); self->currentFrame = frame; self->frameTimer = timer; self->target = &player; if (self->damage == 2) { self->thinkTime = 120; self->action = &teleportPlayer; } else { self->action = &followPlayer; } } }