|
@ -90,17 +90,13 @@ namespace SemiColinGames { |
|
|
public const int TileSize = 16; |
|
|
public const int TileSize = 16; |
|
|
readonly Tile[] tiles; |
|
|
readonly Tile[] tiles; |
|
|
readonly Tile[] decorations; |
|
|
readonly Tile[] decorations; |
|
|
|
|
|
|
|
|
Player player; |
|
|
|
|
|
readonly NPC[] npcs = new NPC[1]; |
|
|
readonly NPC[] npcs = new NPC[1]; |
|
|
|
|
|
|
|
|
// Size of World in terms of tile grid.
|
|
|
// Size of World in terms of tile grid.
|
|
|
private readonly int tileWidth; |
|
|
private readonly int tileWidth; |
|
|
private readonly int tileHeight; |
|
|
private readonly int tileHeight; |
|
|
|
|
|
|
|
|
public Player Player { |
|
|
|
|
|
get { return player; } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public Player Player { get; private set; } |
|
|
|
|
|
|
|
|
// Size of World in pixels.
|
|
|
// Size of World in pixels.
|
|
|
public int Width { |
|
|
public int Width { |
|
@ -112,7 +108,7 @@ namespace SemiColinGames { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public World(string levelSpecification) { |
|
|
public World(string levelSpecification) { |
|
|
player = new Player(); |
|
|
|
|
|
|
|
|
Player = new Player(); |
|
|
npcs[0] = new NPC(new Point(16 * 38, 16 * 12)); |
|
|
npcs[0] = new NPC(new Point(16 * 38, 16 * 12)); |
|
|
var tilesList = new List<Tile>(); |
|
|
var tilesList = new List<Tile>(); |
|
|
var decorationsList = new List<Tile>(); |
|
|
var decorationsList = new List<Tile>(); |
|
@ -162,17 +158,17 @@ namespace SemiColinGames { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void Update(float modelTime, History<Input> input) { |
|
|
public void Update(float modelTime, History<Input> input) { |
|
|
player.Update(modelTime, input, CollisionTargets); |
|
|
|
|
|
|
|
|
Player.Update(modelTime, input, CollisionTargets); |
|
|
foreach (NPC npc in npcs) { |
|
|
foreach (NPC npc in npcs) { |
|
|
npc.Update(modelTime); |
|
|
npc.Update(modelTime); |
|
|
} |
|
|
} |
|
|
if (player.Health <= 0) { |
|
|
|
|
|
|
|
|
if (Player.Health <= 0) { |
|
|
Reset(); |
|
|
Reset(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Reset() { |
|
|
void Reset() { |
|
|
player = new Player(); |
|
|
|
|
|
|
|
|
Player = new Player(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void DrawBackground(SpriteBatch spriteBatch) { |
|
|
public void DrawBackground(SpriteBatch spriteBatch) { |
|
|