[Fix] Added back running.
[Fix] Collisions is only tested against lower half of the actor.
This commit is contained in:
parent
2c50be6573
commit
38abbab93e
@ -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;
|
||||
|
@ -34,4 +34,10 @@ void Player::Move(float dt) {
|
||||
_direction = Actor::FRONT;
|
||||
}
|
||||
|
||||
if(KeyDown(SDLK_LSHIFT)) {
|
||||
_velocity += 3;
|
||||
}
|
||||
if(KeyUp(SDLK_LSHIFT)) {
|
||||
_velocity -= 3;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user