#include "GameState.hh"
#include "Engine.hh"
void Player::handleMove (PlayerInput_Move input) {
float fx = 0;
// handle left/right
if (input & INPUT_MOVE_LEFT)
fx -= PLAYER_MOVE_FORCE;
if (input & INPUT_MOVE_RIGHT)
fx += PLAYER_MOVE_FORCE;
// we behave differently depending on if we're in the air or on the ground
if (inAir) {
// apply horizontal force
if (fx)
applyForce(Vector(fx, 0), INPUT_INTERVAL_MS);
} else {
// walk right
if (fx)
this->position = walk(fx > 0);
// jump?
if (input & INPUT_MOVE_JUMP)
jump();
}
}
void Player::debugInfo (void) {
Engine::log(DEBUG, "Player.debugInfo") << "In air: " << this->inAir;
}