void Enemy_Yellow_Infantery::Move() { SDL_Rect anim = animation->GetCurrentFrame(); float angle; pos_idle = SeePlayer(SDL_Rect{position.x,position.y,anim.w,anim.h }, angle); if (pos_idle == 1 || pos_idle == 2) animation = &Idle_1; else if (pos_idle == 3 || pos_idle == 4) animation = &Idle_2; else if (pos_idle == 5 || pos_idle == 6) animation = &Idle_3; else if (pos_idle == 7 || pos_idle == 8) animation = &Idle_4; else if (pos_idle == 9 || pos_idle == 10) animation = &Idle_5; else if (pos_idle == 11 || pos_idle == 12) animation = &Idle_6; else if (pos_idle == 13 || pos_idle == 14) animation = &Idle_7; else if (pos_idle == 15 || pos_idle == 16) animation = &Idle_8; if (typemove == 1) MoveToPlayer(position.x, position.y, anim.h, anim.w, angle); if (SDL_GetTicks() - lastShot > 5000) { if (SDL_GetTicks() - lasttimelapseShot > 50) { App->particles->AddParticle_Bullet_Enemy(App->particles->test, position.x + (anim.w / 2), position.y + (anim.h / 2), COLLIDER_ENEMY_SHOT, angle); lasttimelapseShot = SDL_GetTicks(); } lastShot = SDL_GetTicks(); } }
void AIUpdate() { if (GetHealthPercent() <= 66 && GetPhase() == 1) { Emote("You landlubbers are tougher than I thought. I'll have to improvise!", Text_Yell, 5778); SetPhase(2, mStomp); } else if (GetHealthPercent() <= 33 && GetPhase() == 3) { Emote("D'ah! Now you're making me angry!", Text_Yell, 5779); SetPhase(4, mStomp); } if (GetPhase() == 2 || GetPhase() == 4) { if (NearChest()) SwitchWeapons(); else if (_unit->GetAIInterface()->getAIState() != STATE_SCRIPTMOVE) { MoveToChest(); } } if (IsTimerFinished(mWaitAtChest)) MoveToPlayer(); ParentClass::AIUpdate(); }