// Use this for initialization void Start() { LogicMap map = new LogicMap((int)x, (int)z); map.TakePosition(5, 4); map.TakePosition(7, 8); for (int i = 0; i < (int)x; i++) { for (int j = 0; j < (int)z; j++) { //Debug.Log(i + ":" + j); if (!map.Map[i, j]) { inst = Instantiate(freePart, new Vector3(i * 2, 0, j * 2), Quaternion.identity); inst.transform.parent = parent.transform; } else { inst = Instantiate(closedPart, new Vector3(i * 2, 0, j * 2), Quaternion.identity); inst.transform.parent = parent.transform; } } } }
private void Start_button_Click(object sender, EventArgs e) { nextX = 0; nextY = 0; gameMap = new LogicMap(); Food.Location = new Point(300, 300); gameSnake.size = 1; gameSnake.tail[0].Location = new Point(250, 250); for (int i = 1; i < 100; i++) { gameSnake.tail[i].Location = new Point(1000, 1000); } Complexity.Enabled = false; CurrentMove = Keys.Space; this.ActiveControl = null; timer.Enabled = true; Stop_button.Enabled = true; Start_button.Enabled = false; }