/// <summary> /// Generates the tiles based on the list of strings. /// </summary> /// <param name="width">Width of map.</param> /// <param name="height">Height of map.</param> /// <param name="lines">Lines from the map.txt file.</param> private void generateTiles(int width, int height, List<string> lines) { for (int i = 0; i < height; i++) { string line = lines [i]; for (int j = 0; j < width; j++) { if (j < line.Length) { char ch = line [j]; TileType type; switch (ch) { case '8': type = TileType.GrassTop; break; case '4': type = TileType.GrassLeft; break; case '6': type = TileType.GrassRight; break; case '2': type = TileType.GrassBottom; break; case '5': type = TileType.Dirt; break; default: type = TileType.Air; break; } Tile t = new Tile (j, i, type, bg, robot); tiles.Add (t); } } } }
public void Landed(Tile t) { _jumped = false; _speedY = 0; _y = t.y - (_image.Height / 2); }