public Gra(int a, int b) { zmiennaCzasu = a; zmiennaCzasu2 = b; InitializeComponent(); System.Media.SoundPlayer player = new System.Media.SoundPlayer(); player.SoundLocation = ""; player.Play(); spider = new Pajak() { Left = 10, Top = 200 }; podmenu = new PodMenu() { Left = 900, Top = 0 }; tablica = new Tablica() { Left = 10, Top = 10 }; boom = new Boom(); }
private void GraMouseClick(object sender, MouseEventArgs e) { System.Media.SoundPlayer slap = new System.Media.SoundPlayer(); slap.SoundLocation = "Slap.wav"; slap.Play(); if (e.X > 923 && e.X < 1182 && e.Y > 93 && e.Y < 140) { uruchomiono = true; timer1.Start(); slap.Stop(); stopWatch.Start(); } else if (e.X > 923 && e.X < 1182 && e.Y > 140 && e.Y < 194) { timer1.Stop(); slap.Stop(); stopWatch.Stop(); } else if (e.X > 923 && e.X < 1182 && e.Y > 194 && e.Y < 249) { spider = new Pajak() { Left = 10, Top = 200 }; timer1.Stop(); uderzeniaCelne = 0; uderzeniaChybione = 0; wszystkieUderzenia = 0; slap.Stop(); } else { if (spider.hit(e.X, e.Y)) { _boom = true; boom.Left = spider.Left - Resources.boom2.Width / 3; boom.Top = spider.Top - Resources.boom2.Height / 3; System.Media.SoundPlayer bitch = new System.Media.SoundPlayer(); slap.Stop(); bitch.SoundLocation = "Got ya bitch.wav"; bitch.Play(); uderzeniaCelne++; } uderzeniaChybione++; wszystkieUderzenia = uderzeniaChybione + uderzeniaCelne; poziomStrachu = uderzeniaChybione * 5; liczbapPunktow = uderzeniaCelne * 100 - uderzeniaChybione * 2; label3.Text = wynik; wynik = liczbapPunktow.ToString(); if (poziomStrachu >= 100) { pictureBox1.Visible = true; timer1.Stop(); label1.BackColor = Color.Transparent; label1.Visible = true; button1.Visible = true; System.Media.SoundPlayer krzyk = new System.Media.SoundPlayer(); krzyk.SoundLocation = "Krzyk.wav"; krzyk.Play(); stopWatch.Stop(); button3.Visible = true; } if (uderzeniaCelne == 5) { pictureBox2.Visible = true; label2.Visible = true; label2.BackColor = Color.Transparent; button1.Visible = true; System.Media.SoundPlayer aplauz = new System.Media.SoundPlayer(); aplauz.SoundLocation = "Aplauz.wav"; aplauz.Play(); stopWatch.Stop(); timer1.Stop(); button3.Visible = true; } } }