Walk the Entity

Just a test.
This commit is contained in:
Riyyi
2015-03-16 20:14:17 +01:00
parent ece39bed38
commit 4a7d2644a8
+19
View File
@@ -15,12 +15,31 @@ void MainGame::Initialize(sf::RenderWindow* window) {
} }
void MainGame::Update(sf::RenderWindow* window) { void MainGame::Update(sf::RenderWindow* window) {
this->entityManager->Get("test0")->velocity.x = 0;
this->entityManager->Get("test0")->velocity.y = 0;
if(inputManager.IsPressed(InputManager::Left)) { if(inputManager.IsPressed(InputManager::Left)) {
std::cout << "LEFT" << std::endl; std::cout << "LEFT" << std::endl;
this->entityManager->Get("test0")->velocity.x = -1;
}
if(inputManager.IsPressed(InputManager::Right)) {
std::cout << "RIGHT" << std::endl;
this->entityManager->Get("test0")->velocity.x = 1;
} }
if(inputManager.IsPressed(InputManager::Down)) { if(inputManager.IsPressed(InputManager::Down)) {
std::cout << "DOWN" << std::endl; std::cout << "DOWN" << std::endl;
this->entityManager->Get("test0")->velocity.y = 1;
}
if(inputManager.IsPressed(InputManager::Up)) {
std::cout << "UP" << std::endl;
this->entityManager->Get("test0")->velocity.y = -1;
} }
this->entityManager->Update(); this->entityManager->Update();