Mario: fix floor detect and top movement helper

This commit is contained in:
zvon 2021-05-26 17:48:33 +02:00
parent d2bc497070
commit 734b0b58cb
2 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ Mario::Mario(const std::shared_ptr< SDLPP::Renderer > &renderer) : SDLPP::Rectan
pauseAnimation(); pauseAnimation();
setMovement( 0, 0 ); setMovement( 0, 0 );
setMovementSpeed( 1 ); setMovementSpeed( 1 );
auto bottom_detect = SDLPP::RectColider( 0.3, 1, 0.4, 0, MARIO_FLOOR_DETECT ); auto bottom_detect = SDLPP::RectColider( 0.2, 1, 0.6, 0, MARIO_FLOOR_DETECT );
bottom_detect.setMinHeight(1); bottom_detect.setMinHeight(1);
addCollision(bottom_detect); addCollision(bottom_detect);
addCollision( addCollision(

View File

@ -45,7 +45,7 @@ public:
return top_hit; return top_hit;
} }
bool moveTop() { bool moveTop() {
return top_left_right; return top_left_right && !top_hit;
} }
const SDLPP::Vec2D<double> &getRightLeftPos() { const SDLPP::Vec2D<double> &getRightLeftPos() {
return rightleftpos; return rightleftpos;