game/mario/mario_visitor.cpp

27 lines
680 B
C++
Raw Normal View History

2021-04-25 20:42:55 +00:00
#include "mario_visitor.hpp"
#include "../sdlpp/sdlpp_renderobject.hpp"
#include "objectids.hpp"
void MarioVisitor::visit( const SDLPP::RenderObject &obj ) {
auto id = obj.getId();
2021-04-26 19:59:21 +00:00
std::cout << from << std::endl;
switch ( id ) {
case FLOOR_OVERWORLD_ID:
if ( from == MARIO_FLOOR_DETECT )
2021-04-25 20:42:55 +00:00
onGround = true;
2021-04-26 19:59:21 +00:00
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;
2021-04-25 20:42:55 +00:00
}
}