private void GenerateFood() { int maxXpos = pbCanvas.Size.Width / Prop.width; int maxYpos = pbCanvas.Size.Width / Prop.height; Random randon = new Random(); food = new body(); food.x = randon.Next(0, maxXpos); food.y = randon.Next(0, maxYpos); }
private void startGame() { labelgameover.Visible = false; new Prop(); snake.Clear(); body head = new body(); head.x = 10; head.y = 5; snake.Add(head); labelScore.Text = Prop.score.ToString(); GenerateFood(); }