private void applyConstraints ( ) { final Map < Tile , Collection < CollisionFormula > > toRemove = new HashMap <> ( ) ; for ( int v = 0 ; v < map . getInTileHeight ( ) ; v ++ ) { for ( int h = 0 ; h < map . getInTileWidth ( ) ; h ++ ) { final Tile tile = map . getTile ( h , v ) ; if ( tile != null ) { final TileCollision tileCollision = tile . getFeature ( TileCollision . class ) ; toRemove . put ( tile , checkConstraints ( tileCollision , h , v ) ) ; } } } for ( final Entry < Tile , Collection < CollisionFormula > > current : toRemove . entrySet ( ) ) { final Tile tile = current . getKey ( ) ; final TileCollision tileCollision = tile . getFeature ( TileCollision . class ) ; for ( final CollisionFormula formula : current . getValue ( ) ) { tileCollision . removeCollisionFormula ( formula ) ; } } }
Apply tile constraints depending of their adjacent collisions .