bool TutorialState::Update(ALLEGRO_EVENT *ev) { bool draw = false; al_get_keyboard_state(&keyState); if (ev->type == ALLEGRO_EVENT_TIMER) { MoveLivingBeings(ev); if (ev->timer.source == RPG::GetInstance()->GetTimer(_RegularTimer)) { player->ControlAttackRate(); RPG::GetInstance()->CheckIfPlayerAttackedSomething(livingBeings, keyState); RPG::GetInstance()->RemoveDeadLivingBeingsFromVector(livingBeings); UpdateSwitches(); tutorialPortal->CheckIfPlayerPassedThrough(player); // if player went through portal to Rakos and has chosen a vocation, teleport it to Rakos Temple if (portalToRakos->PassedThrough(player)) { if (player->getVocation() != _NoVocation) { RPG::GetInstance()->ChangeState(_Rakos); return true; } } UpdateDialogs(); } // controlling sea animation if (ev->timer.source == RPG::GetInstance()->GetTimer(_DrawTimer)) { seaAnimationFrame++; if (seaAnimationFrame > WorldBlockSize-1) seaAnimationFrame = 0; } RPG::GetInstance()->UpdateCamera(worldMapLevel1, livingBeings); RPG::GetInstance()->UpdateAnimationsFrame(livingBeings); RPG::GetInstance()->UpdateAnimationsFrame(portals); if (ev->timer.source == RPG::GetInstance()->GetTimer(_PortalAnimTimer)) portalToRakos->UpdateAnimationFrame(); RPG::GetInstance()->UpdateWeaponAndShieldPositions(livingBeings); RPG::GetInstance()->UpdateWeaponAttackAnimations(livingBeings); player->updateLevel(); sideBar->Update(); // if left mouse pressed and any being is speaking, stop speaking if (RPG::GetInstance()->Mouse->leftMouseButtonReleased) for (LivingBeing *being: livingBeings) being->StopSpeaking(); // sorting vector in the correct drawing order sort(livingBeings.begin(), livingBeings.end(), [](LivingBeing *a, LivingBeing *b) { return a->getY() < b->getY(); }); draw = true; } draw = CheckIfPlayerChoseAVocation(ev); return draw; }
void Shunt::UpdateSwitchesPosition() { if(m_parentList[0]) { m_pointList[1] = GetSwitchPoint(m_parentList[0], m_pointList[0], m_pointList[2]); } else { m_pointList[1] = m_pointList[0]; } UpdateSwitches(); }