Skip to content

Commit

Permalink
Change player 1 keys (use arrows instead of ZQSD (azerty keyboard) )
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlevasseur committed Feb 8, 2016
1 parent c341c8d commit 174a888
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion game/src/Level/Level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ Level::Level(const std::string& path, lua::LuaState& luaState) :
playerEntity,
entityGetter,
m_luaState.getState().get<sol::table>("level").get<sol::table>("spawn_position")
//Directly use the "spawn_position" table as parameter ==> it implies that players templates must only have x and y positions as parameters
//Directly use the "spawn_position" table as parameter ==> it implies that players
//templates must only have x and y positions as parameters
);

std::cout << "Players created." << std::endl;
Expand Down
9 changes: 6 additions & 3 deletions game/src/Systems/PlatformerSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,12 @@ void PlatformerSystem::update(entityx::EntityManager &es, entityx::EventManager
float requestedXMove(0.f), requestedYMove(0.f);

//Watch received events to see the requested moves
bool wantsToJump(sf::Keyboard::isKeyPressed(sf::Keyboard::Z)); //TODO: Use config to get the keys !
bool wantsToGoLeft(sf::Keyboard::isKeyPressed(sf::Keyboard::Q));
bool wantsToGoRight(sf::Keyboard::isKeyPressed(sf::Keyboard::D));
bool wantsToJump(sf::Keyboard::isKeyPressed(sf::Keyboard::Up));
bool wantsToGoLeft(sf::Keyboard::isKeyPressed(sf::Keyboard::Left));
bool wantsToGoRight(sf::Keyboard::isKeyPressed(sf::Keyboard::Right));
//TODO: Put the previous variables as attributes of PlatformerComponent
//and the future PlayerSystem will set them to true or false depending
//of the pressed keys (according to the config)

tools::Polygon polygon = hitbox.getHitbox();
polygon.ComputeGlobalVertices();
Expand Down

0 comments on commit 174a888

Please sign in to comment.