public Fort(int hardnes, string ski, string skinbery) { InitializeComponent(); youLose.Parent = Monitor; youLose.BackColor = Color.FromArgb(50, 0, 0, 0); youLose.Hide(); youLose.Width = this.Width; youLose.Height = this.Height; Skin = ski; SkinBerry = skinbery; youLoseText.Parent = youLose; youLoseText.BackColor = Color.Transparent; youLoseText.Hide(); ScoreWas.Parent = youLose; ScoreWas.BackColor = Color.Transparent; ScoreWas.Hide(); Back.Hide(); button1.Hide(); Score.Parent = Monitor; Score.BackColor = Color.Transparent; hardness = hardnes; snake = new AnySnake(); Berry = new Strawberry(); Berry.texture = new Bitmap("img/Berries/" + SkinBerry + "Berry.png"); snake.ChangeSkin(Skin); bi = new Bitmap(Monitor.Width, Monitor.Height); KeyPreview = true; background = new Bitmap("img/Background.jpg"); SnakeTail = new Bitmap("img/" + snake.Skin + "/SnakeTailL.png"); timer1.Enabled = true; timer2.Enabled = true; timer1.Interval = 100; timer2.Interval = 1; timer2.Start(); gamestarted = true; if (hardness == 1) { timer1.Interval = 100; hardmode = false; } if (hardness == 2) { timer1.Interval = 50; hardmode = false; } if (hardness == 3) { timer1.Interval = 50; hardmode = true; } }
private void button1_Click(object sender, EventArgs e) { timer1.Enabled = true; timer2.Enabled = true; timer2.Start(); snake = new AnySnake(); Berry = new Strawberry(); Berry.texture = new Bitmap("img/Berries/" + SkinBerry + "Berry.png"); snake.ChangeSkin(Skin); youLose.Hide(); youLoseText.Hide(); button1.Hide(); ScoreWas.Hide(); Back.Hide(); count = 0; Score.Text = count.ToString(); gamestarted = true; }