Mario: don't let Mario go left

This commit is contained in:
2021-04-26 21:59:21 +02:00
parent dd6f37264c
commit b0b84101a2
4 changed files with 129 additions and 48 deletions
+17 -8
View File
@@ -4,14 +4,23 @@
void MarioVisitor::visit( const SDLPP::RenderObject &obj ) {
auto id = obj.getId();
switch(id) {
case FLOOR_OVERWORLD_ID:
std::cout << from << std::endl;
switch ( id ) {
case FLOOR_OVERWORLD_ID:
if ( from == MARIO_FLOOR_DETECT )
onGround = true;
break;
case DEATH_ID:
death = true;
break;
default:
break;
else if ( from == MARIO_SIDE_DETECT )
stop = true;
break;
case DEATH_ID:
death = true;
break;
case STOP_MOVEMENT:
stop = true;
newX = obj.getDoubleRect().first.getX() +
obj.getDoubleRect().second.getX();
break;
default:
break;
}
}