static void punch2Sink() { int x; Target *t; if (self->y < self->targetY) { self->y += 3; } else { self->y = self->targetY; setEntityAnimation(self, "CUSTOM_1"); if (self->x != self->endX) { x = self->x < self->endX ? 48 : -48; self->x += x; if (x < 0 && self->x < self->endX) { self->x = self->endX; } else if (x > 0 && self->x > self->endX) { self->x = self->endX; } self->thinkTime = 15; self->targetY = self->y - self->h; self->action = &punch2; } else { self->action = &punchFinish; t = getCenterTarget(); self->targetX = t->x; self->targetY = self->y - self->h; self->dirX = self->speed; } } }
static void die() { Target *t; t = getCenterTarget(); self->targetY = self->endY + self->h; self->targetX = t->x; self->action = &dieSink; self->layer = BACKGROUND_LAYER; }
static void headWait() { Target *t; checkToMap(self); if (self->maxThinkTime <= 0) { t = getCenterTarget(); self->x = t->x - self->w / 2; self->maxThinkTime = 0; self->startX = 60; self->action = &headReform; } }
static void punch2AttackInit() { Target *t; t = getCenterTarget(); self->startX = t->x; t = getTargetByName(player.x < self->x ? "BLOB_TARGET_LEFT" : "BLOB_TARGET_RIGHT"); if (t == NULL) { showErrorAndExit("Blob Boss could not find target"); } self->endX = t->x; self->targetY = self->y + self->h; self->layer = BACKGROUND_LAYER; self->action = &punch2Sink; }
static void punchSink() { Target *t; if (self->y < self->targetY) { self->y += 3; } else { self->y = self->targetY; setEntityAnimation(self, "ATTACK_1"); if (self->maxThinkTime > 0 && player.health > 0) { self->action = &lookForPlayer; self->dirX = self->speed * 1.5; } else { self->action = &punchFinish; t = getCenterTarget(); self->targetX = t->x; self->targetY = self->y - self->h; self->dirX = self->speed; } } }
static void eatExplode() { int i; Entity *e; Target *t; self->maxThinkTime = 0; t = getCenterTarget(); self->startX = 0; for (i=0;i<60;i++) { e = getFreeEntity(); if (e == NULL) { showErrorAndExit("No free slots to add a Blob Boss Part"); } loadProperties("boss/blob_boss_part", e); setEntityAnimation(e, "STAND"); e->flags |= LIMIT_TO_SCREEN; e->x = self->x; e->y = self->y; e->x += prand() % self->w; e->y += prand() % (self->h - e->h); e->dirX = (10 + prand() % 20) * (prand() % 2 == 0 ? 1 : -1); e->dirX /= 10; e->dirY = -6 - prand() % 4; e->touch = &entityTouch; e->damage = 0; e->health = 600; e->action = &partWait; e->pain = &enemyPain; e->draw = &drawLoopingAnimationToMap; e->head = self; e->type = ENEMY; e->targetX = t->x; e->targetY = t->y; self->startX++; } self->target = NULL; self->thinkTime = 120; self->action = &explodeWait; setEntityAnimation(self, "WALK"); self->flags |= NO_DRAW; self->frameSpeed = 0; self->maxThinkTime = 1; self->touch = NULL; }
static void splitAttackInit() { int i; Entity *e; Target *t; self->maxThinkTime = 0; t = getCenterTarget(); for (i=0;i<60;i++) { e = getFreeEntity(); if (e == NULL) { showErrorAndExit("No free slots to add a Blob Boss Part"); } loadProperties("boss/blob_boss_part", e); e->flags |= LIMIT_TO_SCREEN; setEntityAnimation(e, "WALK"); e->x = self->x; e->y = self->y; e->x += prand() % self->w; e->y += prand() % (self->h - e->h); e->dirX = (10 + prand() % 20) * (prand() % 2 == 0 ? 1 : -1); e->dirX /= 10; e->dirY = -6; e->action = &partAttack; e->touch = &partGrab; e->die = &partDie; e->pain = &enemyPain; e->draw = &drawLoopingAnimationToMap; e->takeDamage = &partTakeDamage; e->head = self; e->type = ENEMY; e->thinkTime = 60; e->targetX = t->x; e->targetY = t->y; } self->maxThinkTime = 60; self->action = &headWait; setEntityAnimation(self, "BLOCK"); self->flags |= NO_DRAW; self->frameSpeed = 0; self->touch = NULL; }
void Leg::setCenterTarget() { setTarget(getCenterTarget(), true); }