public void AddWW(WhiteWalker ww) { lista1.Add(ww); }
//void Dvizi(object sender, EventArgs e) //{ // for (int i = 0; i < gm.lista4.Count; i++) // { // gm.lista4[i].Move(20, 60, 10, 10); // gm.proveriUdar(); // lives = lives - gm.poeniTopka; // if (lives == 0) // { // tTopka.Stop(); // topkaCrtaj.Stop(); // tWave.Stop(); // tLvL.Stop(); // t.Stop(); // t1.Stop(); // t2.Stop(); // t3.Stop(); // tt.Stop(); // tt1.Stop(); // tt2.Stop(); // tt3.Stop(); // ttt.Stop(); // ttt1.Stop(); // ttt2.Stop(); // ttt3.Stop(); // this.Hide(); // GameOver gmo = new GameOver(); // gmo.ShowDialog(); // this.Close(); // } // if (gm.lista4[i].x > 1000) // { // gm.lista4[i].kraj = true; // } // } // for (int i = gm.lista4.Count - 1; i >= 0; i--) // { // if (gm.lista4[i].kraj == true) // { // gm.lista4.RemoveAt(i); // } // } // Invalidate(true); //} //функција за создавање на нов бран на објекти void tWave_Tick(object sender, EventArgs e) { if (lvl1 == true)//проверка за ниво { for (int i = 0; i < 10; i++)// изминување на листата { WhiteWalker ww = new WhiteWalker(rnd.Next(50, 900), rnd.Next(50, 500));//креирање објект со рандом координати gm.lista1.Add(ww);//додавање на објектот во листата Invalidate();//прецртување } } else if (lvl2 == true) { for (int i = 0; i < 8; i++) { WhiteWalker ww = new WhiteWalker(rnd.Next(50, 900), rnd.Next(50, 500)); gm.lista1.Add(ww); Invalidate(); } for (int i = 0; i < 2; i++) { WhiteWalker2 ww = new WhiteWalker2(rnd.Next(50, 900), rnd.Next(50, 500)); gm.lista3.Add(ww); Invalidate(); } } else if (lvl3 == true) { for (int i = 0; i < 6; i++) { WhiteWalker ww = new WhiteWalker(rnd.Next(50, 900), rnd.Next(50, 500)); gm.lista1.Add(ww); Invalidate(); } for (int i = 0; i < 4; i++) { WhiteWalker2 ww = new WhiteWalker2(rnd.Next(50, 900), rnd.Next(50, 500)); gm.lista3.Add(ww); Invalidate(); } } }
//функција за создавање на објект од класата WhiteWalker повикувана на одреден интервал private void TimerEventWW(Object myObject, EventArgs myEventArgs) { if (lvl1 == true) { WhiteWalker ww = new WhiteWalker(rnd.Next(50, 900), rnd.Next(50, 450)); gm.lista1.Add(ww); if (((gm.lista1.Count) + (gm.lista3.Count)) > 15) { t.Stop(); t2.Stop(); tWave.Stop(); tLvL.Stop(); this.Hide(); GameOver gmo = new GameOver(); gmo.ShowDialog(); this.Close(); } Invalidate(); } else if (lvl2 == true) { t.Stop(); tt.Start(); WhiteWalker ww = new WhiteWalker(rnd.Next(50, 900), rnd.Next(50, 450)); gm.lista1.Add(ww); if (((gm.lista1.Count) + (gm.lista3.Count)) > 15) { tt.Stop(); tt2.Stop(); tWave.Stop(); tLvL.Stop(); this.Hide(); GameOver gmo = new GameOver(); gmo.ShowDialog(); this.Close(); } Invalidate(); } else if (lvl3 == true) { tt.Stop(); ttt.Start(); WhiteWalker ww = new WhiteWalker(rnd.Next(50, 900), rnd.Next(50, 450)); gm.lista1.Add(ww); if (((gm.lista1.Count) + (gm.lista3.Count)) > 15) { ttt.Stop(); ttt2.Stop(); tWave.Stop(); tLvL.Stop(); this.Hide(); GameOver gmo = new GameOver(); gmo.ShowDialog(); this.Close(); } Invalidate(); } }
public Form1() { this.DoubleBuffered = true; InitializeComponent(); pozadina = Resources.A_Game_of_Thrones_Genesis_03; gm = new GMdoc(); this.BackgroundImage = pozadina; this.Cursor = new Cursor(Application.StartupPath + "\\Cursor.cur"); //label1.BackColor = System.Drawing.Color.Transparent; //label2.BackColor = System.Drawing.Color.Transparent; //label3.BackColor = System.Drawing.Color.Transparent; //label4.BackColor = System.Drawing.Color.Transparent; //label5.BackColor = System.Drawing.Color.Transparent; //label6.BackColor = System.Drawing.Color.Transparent; //label7.BackColor = System.Drawing.Color.Transparent; //label8.BackColor = System.Drawing.Color.Transparent; //label9.BackColor = System.Drawing.Color.Transparent; //label10.BackColor = System.Drawing.Color.Transparent; //label11.BackColor = System.Drawing.Color.Transparent; //label12.BackColor = System.Drawing.Color.Transparent; strela = new SoundPlayer("strela.wav"); score = 0; for (int i = 0; i < 10; i++) { WhiteWalker ww = new WhiteWalker(rnd.Next(50, 900), rnd.Next(50, 500)); gm.lista1.Add(ww); } //Тајмери// tLvL.Tick += new EventHandler(tLvL_Tick); tLvL.Interval = 60000; //tTopka.Tick += new EventHandler(Dvizi); t.Tick += TimerEventWW; t1.Tick += TimerEventNW; t2.Tick += TimerEventWW2; t3.Tick += new EventHandler(brisiNW); topkaCrtaj.Tick += new EventHandler(topkaCrtaj_Tick); topkaCrtaj.Interval = 10000; topkaCrtaj.Start(); tt.Tick += TimerEventWW; tt1.Tick += TimerEventNW; tt2.Tick += TimerEventWW2; tt3.Tick += new EventHandler(brisiNW); ttt.Tick += TimerEventWW; ttt1.Tick += TimerEventNW; ttt2.Tick += TimerEventWW2; ttt3.Tick += new EventHandler(brisiNW); //lvl1 t.Interval = 5000;//WW t1.Interval = 5000;//NW t2.Interval = 20000;//WW2 t3.Interval = 5000;//BrisiNW //lvl2 tt.Interval = 4000; tt1.Interval = 4000; tt2.Interval = 10000; tt3.Interval = 4000; //lvl3 ttt.Interval = 3000; ttt1.Interval = 4000; ttt2.Interval = 8000; ttt3.Interval = 4000; label4.Text = (gm.lista1.Count + gm.lista3.Count).ToString(); tWave.Interval = 15000; tWave.Tick += new EventHandler(tWave_Tick); t1.Start(); t.Start(); t2.Start(); t3.Start(); tLvL.Start(); tWave.Start(); tTopka.Start(); }
private void Form1_MouseClick(object sender, MouseEventArgs e) { strela.Play(); //if (e.X >= eden.x && e.Y >= eden.y && e.X < eden.x + eden.slika.Width && e.Y < eden.y + eden.slika.Height) foreach (WhiteWalker los in (gm.lista1)) { if (e.X >= los.x && e.Y >= los.y && e.X < los.x + 60 && e.Y < los.y + 100) { WW = los; isHit = true; los.zvuk.Play(); score++; } } if (isHit) { gm.lista1.Remove(WW); Invalidate(); } foreach (Night_sWatch nw in gm.lista2) { if (e.X >= nw.x && e.Y >= nw.y && e.X < nw.x + 100 && e.Y < nw.y + 80) { NW = nw; isHit2 = true; nw.zvuk.Play(); score = score - 5; lives--; if (lives == 0) { tTopka.Stop(); topkaCrtaj.Stop(); tWave.Stop(); tLvL.Stop(); t.Stop(); t1.Stop(); t2.Stop(); t3.Stop(); tt.Stop(); tt1.Stop(); tt2.Stop(); tt3.Stop(); ttt.Stop(); ttt1.Stop(); ttt2.Stop(); ttt3.Stop(); this.Hide(); GameOver gmo = new GameOver(); gmo.ShowDialog(); this.Close(); } } } if (isHit2) { gm.lista2.Remove(NW); Invalidate(); } foreach (CannonBall cb in (gm.lista4)) { if (e.X >= cb.x && e.Y >= cb.y && e.X < cb.x + 65 && e.Y < cb.y + 60) { CB = cb; isHit3 = true; //cb.zvuk.Play(); score=score+2; } } if (isHit3) { gm.lista4.Remove(CB); Invalidate(); } }