private void timer1_Tick(object sender, EventArgs e) { switch (Mapa.stav) { case Stav.hrajese: Mapa.PohniVsemiPrvky(); Mapa.VykresliMapu(); Refresh(); break; case Stav.vyhra: timer1.Enabled = false; MessageBox.Show("You win!"); BackToMenu(); break; case Stav.prohra: timer1.Enabled = false; MessageBox.Show("Game over"); BackToMenu(); break; default: break; } }
private void button1_Click(object sender, EventArgs e) //new game { button1.Hide(); button2.Hide(); pictureBox1.Hide(); Mapa.stav = Stav.hrajese; Mapa.NactiMapu(); Mapa.NactiIkonky(); Mapa.VykresliMapu(); timer1.Enabled = true; Mapa.skore = label1; Mapa.lives = label2; Mapa.timer = timer1; Mapa.pacmanTimer = timer2; Mapa.lbl = label3; label1.Visible = true; label2.Visible = true; }