Mario: top collision detection

This commit is contained in:
2021-05-23 23:57:29 +02:00
parent 8672830db8
commit bea479bf72
4 changed files with 12 additions and 1 deletions
+4
View File
@@ -6,6 +6,8 @@ void MarioVisitor::visit( const SDLPP::RenderObject &obj ) {
auto id = obj.getId();
switch ( id ) {
case FLOOR_ID:
case BRICK_ID:
case BRICK_TOP_ID:
if ( from == MARIO_FLOOR_DETECT ) {
onGround = true;
groundY = obj.getPos().getY();
@@ -13,6 +15,8 @@ void MarioVisitor::visit( const SDLPP::RenderObject &obj ) {
left = true;
} else if (from == MARIO_RIGHT_SIDE_DETECT ) {
right = true;
} else if (from == MARIO_TOP_DETECT) {
top_hit = true;
}
break;
case DEATH_ID: