Mario: top collision detection
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user