Teleportation in editor

This commit is contained in:
2022-11-19 22:53:24 +01:00
parent 6ac2726a94
commit 9402f2afa2
12 changed files with 255 additions and 19 deletions
+4 -4
View File
@@ -132,10 +132,10 @@ void Mario::handleVisitor(SDLPP::Visitor &visitor) {
if (m_visitor.hasMushroom()) {
setBig();
}
if (m_visitor.hasTeleport() && isCrouching()) {
std::cout << "TELEPORTING" << std::endl;
if (m_visitor.hasTeleport() && (
(m_visitor.teleportBottom() && isCrouching()) || (!m_visitor.teleportBottom() && walkingRight())
)) {
setTeleportLevelMain(m_visitor.getTeleportLevel());
std::cout << "Setted" << std::endl;
}
if (m_visitor.levelEnd() && controllable) {
if (std::abs(getPos().getX() - m_visitor.getEndPos().getX()) <
@@ -261,6 +261,7 @@ void Mario::setBig() {
} else {
setBigFlag();
setSize({ BLOCK_SIZE, 2 * BLOCK_SIZE });
setPos(getPos() - SDLPP::Vec2D<double>(0, BLOCK_SIZE));
}
setBaseRect(isJumping()
? (hasFire() ? MARIO_JUMP_FIRE_SRC : MARIO_JUMP_BIG_SRC)
@@ -272,7 +273,6 @@ void Mario::setBig() {
change_dir_src = hasFire() ? &MARIO_CHANGE_DIR_FIRE_SRC : &MARIO_CHANGE_DIR_BIG_SRC;
jump_src = hasFire() ? &MARIO_JUMP_FIRE_SRC : &MARIO_JUMP_BIG_SRC;
walk_anim = hasFire() ? &MARIO_WALK_FIRE_ANIM : &MARIO_WALK_BIG_ANIM;
setPos(getPos() - SDLPP::Vec2D<double>(0, BLOCK_SIZE));
}
void Mario::unsetBig() {