fixup! Merge branch 'master' into astar

This commit is contained in:
Simon Holmberg
2012-09-29 00:52:55 +02:00
parent 2d71eb3e0a
commit f694b0969c
2 changed files with 9 additions and 7 deletions
+3 -3
View File
@@ -68,8 +68,7 @@ namespace DepthsBelow
spriteBatch = new SpriteBatch(GraphicsDevice); spriteBatch = new SpriteBatch(GraphicsDevice);
map = Content.Load<Map>("maps/Cave.Level1"); map = Content.Load<Map>("maps/Cave.Level1");
map.ParseObjects(this);
PathFinder = new AStar.PathFinderFast(map.GetCollisionMap()); PathFinder = new AStar.PathFinderFast(map.GetCollisionMap());
PathFinder.Formula = AStar.HeuristicFormula.Manhattan; PathFinder.Formula = AStar.HeuristicFormula.Manhattan;
PathFinder.Diagonals = false; PathFinder.Diagonals = false;
@@ -81,6 +80,8 @@ namespace DepthsBelow
PathFinder.DebugProgress = false; PathFinder.DebugProgress = false;
PathFinder.DebugFoundPath = false; PathFinder.DebugFoundPath = false;
map.ParseObjects(this);
// TODO: use this.Content to load your game content here // TODO: use this.Content to load your game content here
Soldier.LoadContent(this); Soldier.LoadContent(this);
//soldier = new Soldier(this); //soldier = new Soldier(this);
@@ -139,7 +140,6 @@ namespace DepthsBelow
foreach (var soldier in Squad) foreach (var soldier in Squad)
{ {
var sr = soldier.GetComponent<Component.SpriteRenderer>(); var sr = soldier.GetComponent<Component.SpriteRenderer>();
Console.WriteLine("Drawing soldier at: " + soldier.pixelTransform.X + "," + soldier.pixelTransform.Y);
if (sr != null) if (sr != null)
sr.Draw(spriteBatch); sr.Draw(spriteBatch);
} }
+6 -4
View File
@@ -126,13 +126,15 @@ namespace DepthsBelow
byte[,] collisionMap = new byte[1024, 1024]; byte[,] collisionMap = new byte[1024, 1024];
foreach (var layer in Layers) foreach (var layer in Layers)
{ {
if (layer.Name == "Collision") var tileLayer = layer as MapTileLayer;
if (tileLayer.Name == "Collision")
{ {
for (int y = 0; y < layer.Height; y++) for (int y = 0; y < tileLayer.Height; y++)
{ {
for (int x = 0; x < layer.Width; x++) for (int x = 0; x < tileLayer.Width; x++)
{ {
Tile tile = layer.Tiles[y*layer.Width + x]; MapTile tile = tileLayer.Tiles[y * layer.Width + x];
if (tile == null || tile.LocalId == 0) if (tile == null || tile.LocalId == 0)
collisionMap[x, y] = 1; collisionMap[x, y] = 1;
else else