public override void Build() { var defaultLayer = SceneMgr.GetScene("default")["default"]; if (defaultLayer.CountEntities <CheckpointManager>() == 0) { // Checkpoint manager needs to be preserved, when map is deleted. // This is why it's created on a default layer. var checkpoint = new CheckpointManager(defaultLayer); checkpoint.MapName = TiledMap.Name; } else { var checkpoint = defaultLayer.FindEntity <CheckpointManager>(); // If we are loading new map, reset checkpoint manager. if (checkpoint.MapName != TiledMap.Name) { checkpoint.ResetForNewMap(TiledMap.Name); } } base.Build(); // Putting a background. var l = MapScene.CreateLayer("backdrop"); l.Priority = 10000; new Background(l); // Putting a background. }