initial project, implement binary format of display
This commit is contained in:
commit
ea7f12b0c2
1 changed files with 430 additions and 0 deletions
41
TanksServer/MapService.cs
Normal file
41
TanksServer/MapService.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
namespace TanksServer;
|
||||
|
||||
public class MapService
|
||||
{
|
||||
public const int TilesPerRow = 44;
|
||||
public const int TilesPerColumn = 20;
|
||||
public const int TileSize = 8;
|
||||
public const int PixelsPerRow = TilesPerRow * TileSize;
|
||||
public const int PixelsPerColumn = TilesPerColumn * TileSize;
|
||||
|
||||
private string _map = """
|
||||
############################################
|
||||
#...................##.....................#
|
||||
#...................##.....................#
|
||||
#.....####......................####.......#
|
||||
#..........................................#
|
||||
#............###...........###.............#
|
||||
#............#...............#.............#
|
||||
#...##.......#...............#......##.....#
|
||||
#....#..............................#......#
|
||||
#....#..##......................##..#......#
|
||||
#....#..##......................##..#......#
|
||||
#....#..............................#......#
|
||||
#...##.......#...............#......##.....#
|
||||
#............#...............#.............#
|
||||
#............###...........###.............#
|
||||
#..........................................#
|
||||
#.....####......................####.......#
|
||||
#...................##.....................#
|
||||
#...................##.....................#
|
||||
############################################
|
||||
"""
|
||||
.ReplaceLineEndings(string.Empty);
|
||||
|
||||
private char this[int tileX, int tileY] => _map[tileX + tileY * TilesPerRow];
|
||||
|
||||
public bool IsCurrentlyWall(int tileX, int tileY)
|
||||
{
|
||||
return this[tileX, tileY] == '#';
|
||||
}
|
||||
}
|
||||
Reference in a new issue