Mario: add basic big mario logic
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
GoombaBlock::GoombaBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_enemies_texture, GOOMBA_WALK_ANIM[0],
|
||||
true, true) {
|
||||
false, false) {
|
||||
#ifndef EDITOR
|
||||
setAnimationFrames(GOOMBA_WALK_ANIM);
|
||||
setAnimationSpeed(12.5);
|
||||
@@ -22,6 +22,7 @@ GoombaBlock::GoombaBlock(int x, int y,
|
||||
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,
|
||||
NPC_TOP_DETECT));
|
||||
setBouncable(false);
|
||||
#ifndef EDITOR
|
||||
setMovement(-0.19, 0);
|
||||
#endif
|
||||
@@ -58,7 +59,7 @@ void GoombaBlock::handleVisitor(SDLPP::Visitor &visitor) {
|
||||
if (isOnGround()) {
|
||||
setPos(getPos().getX(), g_visitor.getGroundY() - BLOCK_SIZE);
|
||||
}
|
||||
if((!g_visitor.canGoLeft() && getMovement().getX() < 0) ||
|
||||
if ((!g_visitor.canGoLeft() && getMovement().getX() < 0) ||
|
||||
(!g_visitor.canGoRight() && getMovement().getX() > 0)) {
|
||||
setPos(g_visitor.getValidXPos(), getPos().getY());
|
||||
setMovement(-getMovement().getX(), getMovement().getY());
|
||||
|
||||
@@ -28,7 +28,7 @@ void MushroomBlock::custom_move(int ticks) {
|
||||
_parent = nullptr;
|
||||
} else if (_parent == nullptr && !isTraveling() && !_started_movement) {
|
||||
_started_movement = true;
|
||||
setMovement(movementSpeed / 2, 0);
|
||||
setMovement(movementSpeed / 4, 0);
|
||||
}
|
||||
gravity(ticks);
|
||||
MarioBlock::custom_move(ticks);
|
||||
|
||||
Reference in New Issue
Block a user