Mario: change mushroom coliders IDs to NPC specific ones

This commit is contained in:
zvon 2021-08-08 21:41:02 +02:00
parent 94bf4fc39d
commit e31c4bb2db
2 changed files with 6 additions and 6 deletions

View File

@ -8,15 +8,15 @@ MushroomBlock::MushroomBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &
setHidden(true);
ensureCollision();
setId(MUSHROOM_ID);
auto bottom_detect = SDLPP::RectColider( 0.2, 1, 0.6, 0, MARIO_FLOOR_DETECT );
auto bottom_detect = SDLPP::RectColider( 0.2, 1, 0.6, 0, NPC_FLOOR_DETECT );
bottom_detect.setColor("#FF0000");
bottom_detect.setOutlineColor("#FF0000");
bottom_detect.setMinHeight(1);
addCollision(bottom_detect);
addCollision(
SDLPP::RectColider( 0, 0.25, 0.1, 0.6, MARIO_LEFT_SIDE_DETECT ) );
SDLPP::RectColider( 0, 0.25, 0.1, 0.6, NPC_LEFT_SIDE_DETECT ) );
addCollision(
SDLPP::RectColider( 0.9, 0.25, 0.1, 0.6, MARIO_RIGHT_SIDE_DETECT ) );
SDLPP::RectColider( 0.9, 0.25, 0.1, 0.6, NPC_RIGHT_SIDE_DETECT ) );
}
void MushroomBlock::custom_move(int ticks) {

View File

@ -28,16 +28,16 @@ void MushroomVisitor::visit( const SDLPP::RenderObject &obj ) {
case CANNON_TOWER_ID:
case CANNON_PEDESTAL_ID:
case CANNON_ID:
if ( from == MARIO_FLOOR_DETECT ) {
if ( from == NPC_FLOOR_DETECT ) {
onGround = true;
groundY = obj.getPos().getY();
} else if ( from == MARIO_LEFT_SIDE_DETECT ) {
} else if ( from == NPC_LEFT_SIDE_DETECT ) {
if(!left && !right) {
movement_blockage = obj.getPos();
validXPos = movement_blockage.getX() + BLOCK_SIZE;
}
left = true;
} else if (from == MARIO_RIGHT_SIDE_DETECT ) {
} else if (from == NPC_RIGHT_SIDE_DETECT ) {
if(!left && !right) {
movement_blockage = obj.getPos();
validXPos = movement_blockage.getX() - BLOCK_SIZE;