diff --git a/src/Player.cpp b/src/Player.cpp index 1d38d97..87c7e9a 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -27,9 +27,10 @@ void Player::update(float dTime, std::vector &walls, std::vector& co } for (auto &wall : walls){ + int wWidth = wall.size.width(); if (!wall.jumped && !wall.failed){ - if (pos.x() > wall.pos.x() - wall.size.width() / 2 - && pos.x() < wall.pos.x() + wall.size.width() / 2){ + if (pos.x() > wall.pos.x() - wWidth / 2 + && pos.x() < wall.pos.x() + wWidth / 2){ if (pos.y() < wall.pos.y() - wall.size.height()){ wall.jumped = true; auto e = new WallJumpEvent; diff --git a/src/Wall.cpp b/src/Wall.cpp index 6aa09cb..ff8c2d4 100644 --- a/src/Wall.cpp +++ b/src/Wall.cpp @@ -7,7 +7,7 @@ void Wall::draw(QPainter &painter) const { int w = size.width(); int h = size.height(); painter.translate(pos.toPoint()); - painter.fillRect(w / 2, -h, w, h, Qt::red); + painter.fillRect(-w / 2, -h, w, h, Qt::red); painter.restore(); }