public World(Player p) { this.player = p; bgTileMap = new BgTileMap(64, player.vpSize, this); tileMap = new TileMap(64, this); blocks = new List<Block>(); LoadLevel("level.txt"); Lizard.addLizard(TileMap.tiles[82, 72]); Lizard.addLizard(TileMap.tiles[84, 72]); // Lizard.addLizard(TileMap.tiles[82, 74]).block = new world.block.TreeBlock(TileMap.tiles[41, 37].position); }
public static void Render(Camera camera, SpriteBatch spriteBatch) { Vector2 camstart = new Vector2(camera.Position.X, camera.Position.Y); for (int i = ((int)camstart.X / TILESIZE); i < ((int)camstart.X / TILESIZE) + 1 + (35); i++) { if (i < 0 || i > worldSize - 1) { continue; } for (int j = ((int)camstart.Y / TILESIZE); j < ((int)camstart.Y / TILESIZE) + 1 + (20); j++) { if (j < 0 || j > worldSize - 1) { continue; } spriteBatch.Draw(Game1.debugTex, new Rectangle(i * TILESIZE, j * TILESIZE, TILESIZE, TILESIZE), TileMap.getTileByIndex(i, j).Passable? new Color(.1f, .9f, .9f, .01f): new Color(1f, 0f, 0f, .11f)); } } }