Mario: add option to make a block collision-less
This commit is contained in:
@@ -111,15 +111,24 @@ void loadMap( std::shared_ptr< SDLPP::Scene > &scene,
|
||||
col->at( j ) = block;
|
||||
}
|
||||
bool destructible = false;
|
||||
bool removeCollisions = false;
|
||||
if ( !editor &&
|
||||
block.getModifierId() == DESTRUCTIBLE_MODIFIER_ID ) {
|
||||
destructible = true;
|
||||
}
|
||||
if ( !editor &&
|
||||
block.getModifierId() == BACKGROUND_MODIFIER_ID ) {
|
||||
destructible = false;
|
||||
removeCollisions = true;
|
||||
}
|
||||
// TODO add modifiers to createTerrainBlock
|
||||
if(block.getTerrainId() != 0) {
|
||||
auto obj = createTerrainBlock(
|
||||
block.getTerrainId(), block.getTerrainType(),
|
||||
renderer, i, j, destructible, editor );
|
||||
if(removeCollisions) {
|
||||
obj->removeCollisions();
|
||||
}
|
||||
if ( obj != nullptr ) {
|
||||
if ( editor ) {
|
||||
obj->getCollisions()[0]->setId( EDITOR_TERRAIN_ID );
|
||||
|
||||
Reference in New Issue
Block a user