Add fire mario mode
This commit is contained in:
+12
-1
@@ -45,7 +45,7 @@ void MarioBlock::visit(SDLPP::Visitor &visitor) {
|
||||
if (visitor.getFromId() == MARIO_TOP_DETECT) {
|
||||
auto &mario_visitor = dynamic_cast<MarioVisitor &>(visitor);
|
||||
if (mario_visitor.canDestroy()) {
|
||||
if ((_destructible && !hasCoin()) || (_can_be_destroyed && mario_visitor.isBig() && !hasCoin())) {
|
||||
if ((_destructible && !hasCoin() && !hasMushroom()) || (_can_be_destroyed && mario_visitor.isBig() && !hasCoin() && !hasMushroom())) {
|
||||
destroy();
|
||||
} else if (_bouncable) {
|
||||
BounceVisitor bv;
|
||||
@@ -77,7 +77,11 @@ void MarioBlock::visit(SDLPP::Visitor &visitor) {
|
||||
createTerrainBlock(MUSHROOM_ID, LandType::OVERWORLD, renderer);
|
||||
mushroom->setPos(getPos());
|
||||
std::dynamic_pointer_cast<MushroomBlock>(mushroom)->setParent(this);
|
||||
std::dynamic_pointer_cast<MushroomBlock>(mushroom)->setFireFlower(mario_visitor.isBig());
|
||||
dynamic_cast<MarioVisitor &>(visitor).setMushroomBlock(mushroom);
|
||||
if(mario_visitor.isBig()) {
|
||||
harden();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -667,3 +671,10 @@ void MarioBlock::checkVisibility(double rightmost_x) {
|
||||
bool MarioBlock::wasVisible() const {
|
||||
return _was_visible;
|
||||
}
|
||||
|
||||
void MarioBlock::harden() {
|
||||
_can_be_destroyed = false;
|
||||
setDestructible(false);
|
||||
setBouncable(false);
|
||||
setTextureSourceRect(HARD_SRC);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user