void GameState_BasePlayable::UpdateGamePlay (float dT) { const sf::Input& sfInput = Game->GetRenderWindow()->GetInput(); if (sfInput.IsKeyDown(sf::Key::Add)) Game->GetWorldCamera2D()->Zoom(1 + CAM_ZOOM_SPD * dT); else if (sfInput.IsKeyDown(sf::Key::Subtract)) Game->GetWorldCamera2D()->Zoom(1 - CAM_ZOOM_SPD * dT); if (player) { player->Update(dT); Game->GetWorldCamera2D()->SetCenterOfView(player->GetPosition()); if (chest && player->CanInteractWith(chest)) { HUD->SetInteractContextNote(chest, "chest_collect"); } else if (princess && player->CanInteractWith(princess)) { HUD->SetInteractContextNote(princess, princess->IsFollowingAnyone() ? "princess_stop" : "princess_follow"); } else { HUD->SetInteractContextNote(0); } } else { sf::Vector2f worldOffset(0, 0); if (sfInput.IsKeyDown(sf::Key::Left)) worldOffset.x -= CAM_MOVE_SPD * dT; else if (sfInput.IsKeyDown(sf::Key::Right)) worldOffset.x += CAM_MOVE_SPD * dT; if (sfInput.IsKeyDown(sf::Key::Up)) worldOffset.y -= CAM_MOVE_SPD * dT; else if (sfInput.IsKeyDown(sf::Key::Down)) worldOffset.y += CAM_MOVE_SPD * dT; if (worldOffset != sf::Vector2f(0, 0)) Game->GetWorldCamera2D()->Move(worldOffset); } if (princess) princess->Update(dT); if (HUD->GetInteractee()) { if (!interacteeHighlight) { interacteeHighlight = new WorldSprite("Content/Textures/glow.png", LAYER_INTERACTEEHIGHLIGHT); AddWorldSpace(interacteeHighlight); SortAscendingWorld(); } interacteeHighlight->SetPosition(HUD->GetInteractee()->GetPosition()); } else { PopWorldSpace(interacteeHighlight); delete interacteeHighlight; interacteeHighlight = 0; } const EntityMap& guards = (*GameObjects)[ID_GUARD]; Guard* guard; for (EntityMap::const_iterator itG = guards.begin(); itG != guards.end(); itG++) { guard = dynamic_cast<Guard*>(itG->second); guard->Update(dT); if (player) { if (guard->CanSeePlayer(player)) { OnGameFinished(false); } } } }