public Player(int x, int y, int health, char character, string name) { pos = new EntityPos(x, y); this.health = health; this.name = name; this.character = character; }
/// <summary> /// The main constructor of the entity class pos is defined along with type, symbol, health etc. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="health"></param> /// <param name="character"></param> /// <param name="entityType"></param> public Entity(int x, int y, int health, char character, string entityType) { pos = new EntityPos(x, y); this.health = health; this.entityType = entityType; this.character = character; }
public bool canMove(EntityPos pos, int dx, int dy) { try { if (grid.Game_map[new Tuple <int, int>(pos.x + dx, pos.y + dy)].type == TileType.Wall) { return(false); } return(true); } #pragma warning disable 0168 catch (KeyNotFoundException e) #pragma warning restore 0168 { return(false); } }