Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.CompilerServices;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Digger
- {
- public class Game
- {
- private int mapWidth;
- public int MapWidth
- {
- get { return mapWidth; }
- set
- {
- if (value < 0) throw new ArgumentException();
- mapWidth = value;
- }
- }
- private int mapHeight;
- public int MapHeight
- {
- get { return mapHeight; }
- set
- {
- if (value < 0) throw new ArgumentException();
- mapHeight = value;
- }
- }
- public int Scores { get; set; }
- public bool IsOver { get; set; }
- public Keys KeyPressed { get; set; }
- public ICreature[,] Map { get; set; }
- public Game(int mapWidth, int mapHeight)
- {
- MapWidth = mapWidth;
- MapHeight = mapHeight;
- Map = new ICreature[MapWidth,MapHeight];
- var rand = new Random();
- for(var i = 0; i < MapWidth;i++)
- for (var j = 0; j < MapHeight; j++)
- {
- if (i <= 3 || i == 10 || j == 10 || j == 17 || i == 17)
- continue;
- Map[i, j] = new Terrain();
- }
- Map[10, 15] = new Monster();
- Map[1, 1] = new Player();
- for (var a = 0; a < 15; a++)
- {
- Map[rand.Next(0, MapWidth - 1), rand.Next(0, MapHeight - 3)] = new Sack();
- Map[rand.Next(0, MapWidth - 1), rand.Next(0, MapHeight - 1)] = new Gold();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement