public void SetPosition() { calc = new Calculator(); world = World.Instance; // world._rect[x][y].name = "Terrain"; for (int i = rect.Count-1; i > 0; i--) { for (int j = 0; j <= i - 1; j++) { if (rect[j].value > rect[j + 1].value) { Rect highValue = rect[j]; rect[j] = rect[j + 1]; rect[j + 1] = highValue; } } } for (int i = 0; i < rect.Count; i++) { world._rect[rect[i].x][rect[i].y].name = "Player"; Console.WriteLine("--------" + rect[i].value + "------"); } /*for (int i = 0; i <trueRect.Count; i++) { world._rect[trueRect[i].x][trueRect[i].y].name = "Player"; }*/ }
public Game() { InitializeComponent(); CenterToParent(); screenWidth = Width; screenHeight = Height; SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); Timer timer = new Timer(); timer.Interval = 1; timer.Start(); timer.Tick += new EventHandler(UpdateGame); Paint += new PaintEventHandler(DrawGame); world = World.Instance; player = Player.Instance; calc = new Calculator(); }