Mario: check before bouncing
This commit is contained in:
+12
-2
@@ -30,8 +30,18 @@ void MarioBlock::visit( SDLPP::Visitor &visitor ) {
|
||||
if( _destructible ) {
|
||||
destroy();
|
||||
} else {
|
||||
// TODO check if anything above
|
||||
bounce();
|
||||
BounceVisitor bv;
|
||||
bv.setVisitorType(VisitorType::Terrain);
|
||||
|
||||
setPos(getPos() - SDLPP::Vec2D<double>(0, BLOCK_SIZE));
|
||||
if(getCollisions().size() < 2)
|
||||
addCollision(SDLPP::RectColider(0.1, 0.1, 0.8, 0.8, 69));
|
||||
updateSizeAndPosition();
|
||||
g_playground->visitCollisions(*this, bv);
|
||||
setPos(getPos() + SDLPP::Vec2D<double>(0, BLOCK_SIZE));
|
||||
updateSizeAndPosition();
|
||||
if(bv.canBounce())
|
||||
bounce();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user