//----------------------------------------------------------------------------- // Game::Update() // Called once per frame, update data, tranformations, etc // Use this function to control process order // Input, AI, Physics, Animation, and Graphics //----------------------------------------------------------------------------- void Game::Update() { // Grabs the current time Time_Engine time = timer->toc(); float curTime = Time_Engine::quotientFloat(time, Time_Engine(TIME_ONE_MILLISECOND)) /1000; // Update cameras - make sure everything is consistent pCam2D->updateCamera(); // Add your update below this line: ---------------------------- //KeyboardTest(); //MouseTest(); // Updates the Physics system World::Update(); GameManager::Update(curTime); Mouse * mouse = Mouse::GetInstance(); Keyboard *key = Keyboard::GetInstance(); if (key->GetKeyState(AZUL_KEY::KEY_W)) { Bot * bot = GameManager::getBot(playerBot->getBotID()); Vect dir = bot->getPos() + Vect(0.0f, 1.0f, 0.0f); bot->MoveToPosition(dir); } if (key->GetKeyState(AZUL_KEY::KEY_D)) { Bot * bot = GameManager::getBot(playerBot->getBotID()); Vect dir = bot->getPos() + Vect(1.0f, 0.0f, 0.0f); bot->MoveToPosition(dir); } if (key->GetKeyState(AZUL_KEY::KEY_A)) { Bot * bot = GameManager::getBot(playerBot->getBotID()); Vect dir = bot->getPos() + Vect(-1.0f, 0.0f, 0.0f); bot->MoveToPosition(dir); } if (key->GetKeyState(AZUL_KEY::KEY_S)) { Bot * bot = GameManager::getBot(playerBot->getBotID()); Vect dir = bot->getPos() + Vect(0.0f, -1.0f, 0.0f); bot->MoveToPosition(dir); } if (key->GetKeyState(AZUL_KEY::KEY_J)) { Bot * bot = GameManager::getBot(playerBot->getBotID()); angle += 2.0f; bot->RotateToAngle(angle); } if (key->GetKeyState(AZUL_KEY::KEY_K)) { Bot * bot = GameManager::getBot(playerBot->getBotID()); angle += -2.0f; bot->RotateToAngle(angle); } if (key->GetKeyState(AZUL_KEY::KEY_R)) { // search2 = true; } if (key->GetKeyState(AZUL_KEY::KEY_SPACE)) { Bot * bot = GameManager::getBot(playerBot->getBotID()); if (bot->getRifleAmmo() > 0) { bot->Fire(LASER); } else { bot->Fire(PISTOL); } } playerBot->UpdateBot(GameManager::getBot(playerBot->getBotID())); defaultBot->UpdateBot(GameManager::getBot(defaultBot->getBotID())); float posX = 0.0f; float posY = 0.0f; mouse->GetCursor(posX, posY); posY = 800 - posY; int dani = playerBot->getGraph()->getNodeId(posX,posY); mouseDisplay->Update( // "x:"+std::to_string((int)posX) //+ " y:" + std::to_string((int)posY) //+ " ax:" + std::to_string((int)ax) //+ // " ay:" + std::to_string((int)ay) // + "id:" + std::to_string(dani) ,posX, posY, 1.0f, 1.0f); if (mouse->GetKeyState(AZUL_MOUSE::BUTTON_LEFT)) { playerBot->setGoal(posX,posY); } }