[Fix] Added back running.

[Fix] Collisions is only tested against lower half of the actor.
This commit is contained in:
Tamir Atias 2012-04-17 20:54:41 +03:00
parent 2c50be6573
commit 38abbab93e
2 changed files with 9 additions and 1 deletions

View File

@ -59,8 +59,10 @@ void Actor::Update(float dt) {
Move(dt);
float collisionYOffset = GetMaxHeight() / 2.0f;
if(x != oldX || y != oldY) {
if(_level->CheckCollision(x, y, GetAnimation()->GetMaxWidth(), GetAnimation()->GetMaxHeight())) {
if(_level->CheckCollision(x, y + collisionYOffset, GetAnimation()->GetMaxWidth(), GetAnimation()->GetMaxHeight() - collisionYOffset)) {
x = oldX;
y = oldY;
return;

View File

@ -34,4 +34,10 @@ void Player::Move(float dt) {
_direction = Actor::FRONT;
}
if(KeyDown(SDLK_LSHIFT)) {
_velocity += 3;
}
if(KeyUp(SDLK_LSHIFT)) {
_velocity -= 3;
}
}