Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Monofoxe/Monofoxe.Tiled/MapBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,6 @@ protected Tileset GetTilesetFromTileIndex(int index)
/// </summary>
protected virtual List<Layer> BuildLayers(List<Tileset> tilesets)
{
if (TiledMap.GetLayers<TiledMapTileLayer>().Length != 0)
{
CreateTileLookupTable(tilesets);
}

var layers = new List<Layer>();

foreach (var mapLayer in TiledMap.Layers)
Expand All @@ -175,6 +170,11 @@ protected virtual List<Layer> BuildLayers(List<Tileset> tilesets)

if (mapLayer is TiledMapTileLayer)
{
if (_tilesetLookupMap == null)
{
CreateTileLookupTable(tilesets);
}

BuildTileLayer((TiledMapTileLayer)mapLayer, layer);
}
if (mapLayer is TiledMapObjectLayer)
Expand Down
2 changes: 2 additions & 0 deletions Samples/Monofoxe.Samples/Game1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ protected override void Initialize()

GraphicsMgr.VertexBatch.DepthStencilState = depth;

InactiveSleepTime = new System.TimeSpan(0); // Makes game not drop frames when window is inactive.

new GameController();
}

Expand Down
1 change: 1 addition & 0 deletions Samples/Monofoxe.Samples/GameController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class GameController : Entity

private Stopwatch _stopwatch = new Stopwatch();

// It is recommended to reuse random objects.
public static RandomExt Random = new RandomExt();

public GameController() : base(SceneMgr.GetScene("default")["default"])
Expand Down
2 changes: 1 addition & 1 deletion Samples/Monofoxe.Samples/SceneSwitcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class SceneSwitcher : Entity
new SceneFactory(typeof(ECDemo), ECDemo.Description),
new SceneFactory(typeof(SceneSystemDemo), SceneSystemDemo.Description),
new SceneFactory(typeof(UtilsDemo)),
new SceneFactory(typeof(TiledDemo)),
new SceneFactory(typeof(TiledDemo), TiledDemo.Description),
new SceneFactory(typeof(VertexBatchDemo)),
new SceneFactory(typeof(CoroutinesDemo)),
new SceneFactory(typeof(CollisionsDemo)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Monofoxe.Samples.Misc.Tiled
public class SolidMapBuilder : MapBuilder
{

public SolidMapBuilder(TiledMap tiledMap) : base(tiledMap) {}
public SolidMapBuilder(TiledMap tiledMap) : base(tiledMap) { }

public override void Build()
{
Expand Down Expand Up @@ -63,11 +63,11 @@ ITilesetTile[] ConvertTiles(TiledMapTileset tiledTileset, Tileset tileset)

// Getting solid property from the tile.
var solid = false;
try

if (tiledTile.Properties.ContainsKey("Solid"))
{
solid = bool.Parse(tiledTile.Properties["Solid"]);
}
catch (Exception) {}
// Getting solid property from the tile.

SolidTilesetTile tilesetTile;
Expand Down