Compare commits

..

No commits in common. "b98d283d09465272ee3cd1c1ab9d623d907911df" and "e87495db2e891d11f3514c1360f1bd16ffdea127" have entirely different histories.

View File

@ -20,7 +20,7 @@ GoombaBlock::GoombaBlock(int x, int y,
addCollision(SDLPP::RectColider(0, 0.25, 0.1, 0.6, NPC_LEFT_SIDE_DETECT)); addCollision(SDLPP::RectColider(0, 0.25, 0.1, 0.6, NPC_LEFT_SIDE_DETECT));
addCollision( addCollision(
SDLPP::RectColider(0.9, 0.25, 0.1, 0.6, NPC_RIGHT_SIDE_DETECT)); SDLPP::RectColider(0.9, 0.25, 0.1, 0.6, NPC_RIGHT_SIDE_DETECT));
addCollision(std::make_shared<SDLPP::RectColider>(0.35, 0, 0.3, 0.15, addCollision(std::make_shared<SDLPP::RectColider>(0.5, 0, 0.2, 0.15,
NPC_TOP_DETECT)); NPC_TOP_DETECT));
#ifndef EDITOR #ifndef EDITOR
setMovement(-0.19, 0); setMovement(-0.19, 0);
@ -58,8 +58,7 @@ void GoombaBlock::handleVisitor(SDLPP::Visitor &visitor) {
if (isOnGround()) { if (isOnGround()) {
setPos(getPos().getX(), g_visitor.getGroundY() - BLOCK_SIZE); setPos(getPos().getX(), g_visitor.getGroundY() - BLOCK_SIZE);
} }
if((!g_visitor.canGoLeft() && getMovement().getX() < 0) || if (!g_visitor.canGoLeft() || !g_visitor.canGoRight()) {
(!g_visitor.canGoRight() && getMovement().getX() > 0)) {
setPos(g_visitor.getValidXPos(), getPos().getY()); setPos(g_visitor.getValidXPos(), getPos().getY());
setMovement(-getMovement().getX(), getMovement().getY()); setMovement(-getMovement().getX(), getMovement().getY());
} }