Compare commits
2 Commits
e87495db2e
...
b98d283d09
Author | SHA1 | Date | |
---|---|---|---|
b98d283d09 | |||
c8e749a145 |
@ -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.9, 0.25, 0.1, 0.6, NPC_RIGHT_SIDE_DETECT));
|
||||
addCollision(std::make_shared<SDLPP::RectColider>(0.5, 0, 0.2, 0.15,
|
||||
addCollision(std::make_shared<SDLPP::RectColider>(0.35, 0, 0.3, 0.15,
|
||||
NPC_TOP_DETECT));
|
||||
#ifndef EDITOR
|
||||
setMovement(-0.19, 0);
|
||||
@ -58,7 +58,8 @@ void GoombaBlock::handleVisitor(SDLPP::Visitor &visitor) {
|
||||
if (isOnGround()) {
|
||||
setPos(getPos().getX(), g_visitor.getGroundY() - BLOCK_SIZE);
|
||||
}
|
||||
if (!g_visitor.canGoLeft() || !g_visitor.canGoRight()) {
|
||||
if((!g_visitor.canGoLeft() && getMovement().getX() < 0) ||
|
||||
(!g_visitor.canGoRight() && getMovement().getX() > 0)) {
|
||||
setPos(g_visitor.getValidXPos(), getPos().getY());
|
||||
setMovement(-getMovement().getX(), getMovement().getY());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user