private void GenerateToxic() { int xborder = pbCanvas.Size.Width / 32; int yborder = pbCanvas.Size.Height / 32; Random random = new Random(); toxic = new image { X = random.Next(0, xborder), Y = random.Next(0, yborder) }; }
private void Eat() { image food = new image { X = Snake[Snake.Count - 1].X, Y = Snake[Snake.Count - 1].Y }; Snake.Add(food); Settings.Score += Settings.Points; lblScore.Text = Settings.Score.ToString(); GenerateFood(); }
private void StartGame() { lblState.Visible = false; life_pic1.Visible = true; life_pic2.Visible = true; life_pic3.Visible = true; new Settings(); Snake.Clear(); image head = new image { X = 10, Y = 1 }; Snake.Add(head); lblScore.Text = Settings.Score.ToString(); GenerateFood(); }