Mario: better mushroom movement

This commit is contained in:
2021-08-07 22:17:27 +02:00
parent a194bfb86e
commit f7002f0f38
4 changed files with 11 additions and 1 deletions
+4
View File
@@ -42,7 +42,11 @@ void MushroomBlock::handleVisitor(SDLPP::Visitor &visitor) {
}
auto &m_visitor = dynamic_cast<MushroomVisitor&>(visitor);
setOnGround(m_visitor.isOnGround());
if(isOnGround()) {
setPos(getPos().getX(), m_visitor.getGroundY() - BLOCK_SIZE);
}
if(!m_visitor.canGoLeft() || !m_visitor.canGoRight()) {
setPos(m_visitor.getValidXPos(), getPos().getY());
setMovement(-getMovement().getX(), getMovement().getY());
}
if(m_visitor.getDeath()) {