Presentation is loading. Please wait.

Presentation is loading. Please wait.

YILAN ATILGAN DAĞILGAN 2010514019. Flow Diagram Of The Program Home Screen Choose Difficulty Start Direction of the Snake DeathStop Show Score Yes No.

Similar presentations


Presentation on theme: "YILAN ATILGAN DAĞILGAN 2010514019. Flow Diagram Of The Program Home Screen Choose Difficulty Start Direction of the Snake DeathStop Show Score Yes No."— Presentation transcript:

1 YILAN ATILGAN DAĞILGAN

2 Flow Diagram Of The Program Home Screen Choose Difficulty Start Direction of the Snake DeathStop Show Score Yes No Movement of the Snake Show Target True Increase Score Increase Tail Define New Target Play Sound False Wait 100ms or 500ms depend on difficulty Reach Target

3 Difficulty private void Kolay_Click(object sender, EventArgs e) { Kolay2.Visible = true; Kolay.Visible = false; Zor.Visible = true; Zor2.Visible = false; zorluk = 500; } private void Zor_Click(object sender, EventArgs e) { Kolay.Visible = true; Kolay2.Visible = false; Zor2.Visible = true; Zor.Visible = false; zorluk = 100; }

4 Start private void Basla_Click(object sender, EventArgs e) { timer1.Enabled = true; timer1.Interval = zorluk; Basla.Visible = false; Kolay.Visible = false; Zor.Visible = false; Kolay2.Visible = false; Zor2.Visible = false; Kapat.Visible = false; AnaSayfa.Visible = false; }

5 public void timer1_Tick(object sender, EventArgs e) { kafa_hareketi isim1 = new kafa_hareketi(yukarisi, asagisi, solu, sagı, kafa); label1.Text = puan.ToString(); label2.Text = puan.ToString(); kafa = isim1.kafaclass; a = a + 1; Olum(); belirme(); kaybolma(); YemBelirme(); if (yem == kafa) { puan = puan + 123; kuyruk = kuyruk + 1; YemYeri(); System.Media.SystemSounds.Beep.Play(); } }

6 «kafa_hareketi» public int kafaclass; public kafa_hareketi(bool yukari,bool asagi,bool sol,bool sag,int kafa) { if(yukari==true) { kafa = kafa - 20; if(kafa < 1) { kafa = kafa + 400; } if (asagi == true) { kafa = kafa + 20; if (kafa > 400) { kafa = kafa - 400; }

7 if (sol == true) { kafa = kafa-1; if(kafa==0||kafa==20||kafa==40||kafa==60||kafa==80||kafa==100||kafa== 120||k afa==140||kafa==160||kafa==180||kafa==200||kafa==220||kafa= =240||kafa== 260||kafa==280||kafa==300||kafa==320||kafa==340||kafa==360 ||kafa==380) { kafa = kafa + 20; } if (sag == true) { kafa = kafa+1; if (kafa == 401 || kafa == 21 || kafa == 41 || kafa == 61 || kafa == 81 || kafa == 101 || kafa == 121 || kafa == 141 || kafa == 161 || kafa == 181 || kafa == 201 || kafa == 221 || kafa == 241 || kafa == 261 || kafa == 281 || kafa == 301 || kafa == 321 || kafa == 341 || kafa == 361 || kafa == 381) { kafa = kafa - 20; } kafaclass = kafa;

8 Olum() switch(kafa) { case 1: if(pictureBox1.Visible==true & yem!=1) { AnaSayfa.Visible = true; OyunBitti.Visible = true; label2.Visible = true; timer2.Enabled = true; } break; case 2: if (pictureBox2.Visible == true & yem != 2) { AnaSayfa.Visible = true; OyunBitti.Visible = true; label2.Visible = true; timer2.Enabled = true; }

9 timer2_Tick OyunBitti.Visible = false; label2.Visible = false; timer2.Enabled = false; Sifirla();

10 Sifirla() timer1.Enabled = false; kuyruk = 3; kafa = 210; yukarisi = false; asagisi = false; solu = false; sagı = true; Basla.Visible = true; Kapat.Visible = true; if(timer1.Interval==500) { Kolay2.Visible = true; Zor.Visible = true; } else { Kolay.Visible = true; Zor2.Visible = true; } pictureBox1.Visible = false; pictureBox2.Visible = false; pictureBox3.Visible = false;

11 belirme() switch (kafa) { case 1: pictureBox1.Visible = true; array1[1] = a; break; case 2: pictureBox2.Visible = true; array1[2] = a; break;

12 kaybolma() if ((array1[1] + kuyruk) == a) pictureBox1.Visible = false; if ((array1[2] + kuyruk) == a) pictureBox2.Visible = false; if ((array1[3] + kuyruk) == a) pictureBox3.Visible = false;

13 YemYeri() Random rastgele=new Random(); for(bool tekrar=true;tekrar==true;) { switch(yem) { case 1: if(pictureBox1.Visible==true) { yem = rastgele.Next(1, 401); tekrar = true; break; } tekrar = false; break; case 2: if (pictureBox2.Visible == true) { yem = rastgele.Next(1, 401); tekrar = true; break; } tekrar = false; break;

14 References  up-down-left-and-right-arrow-keys-do-not- trigger-keydown-event  ama_Dili/Rastgele_say%C4%B1_%C3%BCretm e  2006/03/27/ aspx

15


Download ppt "YILAN ATILGAN DAĞILGAN 2010514019. Flow Diagram Of The Program Home Screen Choose Difficulty Start Direction of the Snake DeathStop Show Score Yes No."

Similar presentations


Ads by Google