using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Pacman_Zagorschi_Franco
public partial class Form1 : Form
public int leftghost1, leftghost2, leftghost3, leftghost4, left;
public int topghost1, topghost2, topghost3, topghost4, top;
public int next, direzione, temp = 1;
public bool pacturn, ghost1turn, ghost2turn, ghost3turn, ghost4turn, start, ghost1puomangiare, ghost2puomangiare, ghost3puomangiare, ghost4puomangiare, g1mangiato, g2mangiato, g3mangiato, g4mangiato;
public bool dir1, dir2, dir3, dir4, c, Supermod, Supermod1, Supermod2, Supermod3, Supermod4, v1, v2, v3, v4, tresec = true;
public int random1, random2, random3, random4, vita = 3, tic4, tic5, tic6, point;
private void panel2_Paint(object sender, PaintEventArgs e)
private void label255_Click_1(object sender, EventArgs e)
private void menuStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
private void button2_Click(object sender, EventArgs e)
private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
private void textBox1_TextChanged(object sender, EventArgs e)
private void label253_Click_1(object sender, EventArgs e)
private void linkLabel1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
private void checkBox1_CheckedChanged(object sender, EventArgs e)
private void button2_Click_1(object sender, EventArgs e)
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
private void comboBox1_SelectedIndexChanged_1(object sender, EventArgs e)
private void toolTip1_Popup(object sender, PopupEventArgs e)
private void button2_Click_2(object sender, EventArgs e)
private void textBox2_TextChanged(object sender, EventArgs e)
private void label253_Click_2(object sender, EventArgs e)
private void label253_Click(object sender, EventArgs e)
private void label254_Click_1(object sender, EventArgs e)
private void pictureBox5_Click(object sender, EventArgs e)
private void label255_Click(object sender, EventArgs e)
private void label254_Click(object sender, EventArgs e)
private void panel1_Paint(object sender, PaintEventArgs e)
private void label142_Click(object sender, EventArgs e)
private void pictureBox4_Click(object sender, EventArgs e)
private void pictureBox3_Click(object sender, EventArgs e)
public int prec1, prec2, prec3, prec4, startdirection = 1, ghost1velocity = 2, ghost2velocity = 2, ghost3velocity = 2, ghost4velocity = 2;
public Random rand = new Random();
public List<object> oggetti = new List<object>();
private void button1_Click(object sender, EventArgs e)
private void Form1_KeyDown(object sender, KeyEventArgs e)
if (e.KeyCode == Keys.Left) next = 1;
if (e.KeyCode == Keys.Right) next = 2;
if (e.KeyCode == Keys.Up) next = 3;
if (e.KeyCode == Keys.Down) next = 4;
if (e.KeyCode == Keys.Escape) Close();
private void button1_MouseLeave(object sender, EventArgs e)
button1.Image = Properties.Resources.playgame;
private void button1_MouseEnter(object sender, EventArgs e)
button1.Image = Properties.Resources.playgame2;
private void timer1_Tick(object sender, EventArgs e)
if (ghost1.Enabled || ghost2.Enabled || ghost3.Enabled || ghost4.Enabled)
private void timer2_Tick(object sender, EventArgs e)
private void timer3_Tick(object sender, EventArgs e)
if (ghost2.Top == 180) startdirection = 2;
if (ghost2.Top == 192) startdirection = 1;
private void timer4_Tick(object sender, EventArgs e)
if (ghost3.Top > 150 && tic4 > 100) { prec1 = 3; ghost3.Top--; }
if (ghost3.Top == 150) timer4.Enabled = false;
private void timer5_Tick(object sender, EventArgs e)
if (ghost2.Left > 153 && ghost2.Left < 176 && tic5 > 300) ghost2.Left++;
if (ghost2.Top > 150 && ghost2.Left == 176) { ghost2.Top--; }
if (ghost2.Top == 150) { timer6.Enabled = true; timer5.Enabled = false; }
private void timer6_Tick(object sender, EventArgs e)
if (ghost4.Left > 176 && ghost4.Left < 200 && tic6 > 100) ghost4.Left--;
if (ghost4.Top > 150 && ghost4.Left == 176) { ghost4.Top--; }
if (ghost4.Top == 150) timer6.Enabled = false;
private void powermod_Tick(object sender, EventArgs e)
ghost1puomangiare = true;
ghost2puomangiare = true;
ghost3puomangiare = true;
ghost4puomangiare = true;
powermod.Enabled = false;
powermod1.Enabled = false;
if (prec1 == 1 && !g1mangiato) { if (ghost1.Left % 2 == 0) leftghost1 = ghost1velocity; ghost1.Image = Properties.Resources.rdx; }
if (prec1 == 2 && !g1mangiato) { if (ghost1.Left % 2 == 0) leftghost1 = -ghost1velocity; ghost1.Image = Properties.Resources.rsx; }
if (prec1 == 3 && !g1mangiato) { if (ghost1.Top % 2 == 0) topghost1 = -ghost1velocity; ghost1.Image = Properties.Resources.rup; }
if (prec1 == 4 && !g1mangiato) { if (ghost1.Top % 2 == 0) topghost1 = ghost1velocity; ghost1.Image = Properties.Resources.rdown; }
if (prec2 == 1 && !g2mangiato) { if (ghost2.Left % 2 == 0) leftghost2 = ghost2velocity; ghost2.Image = Properties.Resources.adx; }
if (prec2 == 2 && !g2mangiato) { if (ghost2.Left % 2 == 0) leftghost2 = -ghost2velocity; ghost2.Image = Properties.Resources.asx; }
if (prec2 == 3 && !g2mangiato) { if (ghost2.Top % 2 == 0) topghost2 = -ghost2velocity; ghost2.Image = Properties.Resources.aup; }
if (prec2 == 4 && !g2mangiato) { if (ghost2.Top % 2 == 0) topghost2 = ghost2velocity; ghost2.Image = Properties.Resources.adown; }
if (prec3 == 1 && !g3mangiato) { if (ghost3.Left % 2 == 0) leftghost3 = ghost3velocity; ghost3.Image = Properties.Resources.vdx; }
if (prec3 == 2 && !g3mangiato) { if (ghost3.Left % 2 == 0) leftghost3 = -ghost3velocity; ghost3.Image = Properties.Resources.vsx; }
if (prec3 == 3 && !g3mangiato) { if (ghost3.Top % 2 == 0) topghost3 = -ghost3velocity; ghost3.Image = Properties.Resources.vup; }
if (prec3 == 4 && !g3mangiato) { if (ghost3.Top % 2 == 0) topghost3 = ghost3velocity; ghost3.Image = Properties.Resources.vdown; }
if (prec4 == 1 && !g4mangiato) { if (ghost4.Left % 2 == 0) leftghost4 = ghost4velocity; ghost4.Image = Properties.Resources.gdx; }
if (prec4 == 2 && !g4mangiato) { if (ghost4.Left % 2 == 0) leftghost4 = -ghost4velocity; ghost4.Image = Properties.Resources.gsx; }
if (prec4 == 3 && !g4mangiato) { if (ghost4.Top % 2 == 0) topghost4 = -ghost4velocity; ghost4.Image = Properties.Resources.gup; }
if (prec4 == 4&& !g4mangiato) { if (ghost4.Top % 2 == 0) topghost4 = ghost4velocity; ghost1.Image = Properties.Resources.gdown; }
private void timer8_Tick(object sender, EventArgs e)
pacman.SetBounds(pacman.Left, pacman.Top, 0, 0);
ghost1puomangiare = true;
ghost2puomangiare = true;
ghost3puomangiare = true;
ghost4puomangiare = true;
pacman.Image = Properties.Resources._1dx;
ghost1.Image = Properties.Resources.rup;
ghost2.Image = Properties.Resources.aup;
ghost3.Image = Properties.Resources.vup;
ghost4.Image = Properties.Resources.gup;
pacman.SetBounds(pacman.Left, pacman.Top, 22, 22);
private void timer9_Tick(object sender, EventArgs e)
pictureBox3.Visible = true;
ghost1puomangiare = true;
ghost2puomangiare = true;
ghost3puomangiare = true;
ghost4puomangiare = true;
label124.Visible = false;
label141.Visible = false;
pacman.SetBounds(pacman.Left, pacman.Top, 22, 22);
pacman.Image = Properties.Resources._1dx;
ghost1.Image = Properties.Resources.rup;
ghost2.Image = Properties.Resources.aup;
ghost3.Image = Properties.Resources.vup;
ghost4.Image = Properties.Resources.gup;
powermod.Enabled = false;
powermod1.Enabled = false;
for (int i = 0; i < 332; i++) ((Label)oggetti[i]).Visible = true;
private void timer7_Tick(object sender, EventArgs e)
private void attendo_Tick(object sender, EventArgs e)
if (ghost2.Top == 185) { timer3.Enabled = false; timer4.Enabled = true; c = false; timer5.Enabled = true; }
pictureBox1.Visible = true;
pictureBox2.Visible = true;
pictureBox1.Visible = true;
pictureBox2.Visible = false;
pictureBox1.Visible = false;
pictureBox2.Visible = false;
if (pacman.Bounds.IntersectsWith(label173.Bounds) && label173.Visible == true) supermod2();
if (pacman.Bounds.IntersectsWith(label307.Bounds) && label307.Visible == true) supermod2();
if (pacman.Bounds.IntersectsWith(label220.Bounds) && label220.Visible == true) supermod2();
if (pacman.Bounds.IntersectsWith(label71.Bounds) && label71.Visible == true) supermod2();
ghost1.Image = Properties.Resources.crazy;
ghost1puomangiare = true;
ghost2.Image = Properties.Resources.crazy;
ghost2puomangiare = true;
ghost3.Image = Properties.Resources.crazy;
ghost3puomangiare = true;
ghost4.Image = Properties.Resources.crazy;
ghost4puomangiare = true;
powermod.Enabled = false;
powermod1.Enabled = false;
powermod1.Enabled = true;
private void powermod1_Tick(object sender, EventArgs e)
powermod1.Enabled = false;
if (pacman.Bounds.IntersectsWith(ghost1.Bounds) || pacman.Bounds.IntersectsWith(ghost2.Bounds) || pacman.Bounds.IntersectsWith(ghost3.Bounds) || pacman.Bounds.IntersectsWith(ghost4.Bounds))
if (pacman.Bounds.IntersectsWith(ghost1.Bounds) && !Supermod1) mangiato();
if (pacman.Bounds.IntersectsWith(ghost2.Bounds) && !Supermod2) mangiato();
if (pacman.Bounds.IntersectsWith(ghost3.Bounds) && !Supermod3) mangiato();
if (pacman.Bounds.IntersectsWith(ghost4.Bounds) && !Supermod4) mangiato();
if (pacman.Bounds.IntersectsWith(ghost1.Bounds) && !Supermod1) mangiato();
if (pacman.Bounds.IntersectsWith(ghost2.Bounds) && !Supermod2) mangiato();
if (pacman.Bounds.IntersectsWith(ghost3.Bounds) && !Supermod3) mangiato();
if (pacman.Bounds.IntersectsWith(ghost4.Bounds) && !Supermod4) mangiato();
if (pacman.Bounds.IntersectsWith(ghost1.Bounds) && ghost1puomangiare && Supermod1)
ghost1puomangiare = false;
ghostmangiato.Enabled = true;
if (pacman.Bounds.IntersectsWith(ghost2.Bounds) && ghost2puomangiare && Supermod2)
ghost2puomangiare = false;
ghostmangiato.Enabled = true;
if (pacman.Bounds.IntersectsWith(ghost3.Bounds) && ghost3puomangiare && Supermod3)
ghost3puomangiare = false;
ghostmangiato.Enabled = true;
if (pacman.Bounds.IntersectsWith(ghost4.Bounds) && ghost4puomangiare && Supermod4)
ghost4puomangiare = false;
ghostmangiato.Enabled = true;
private void ghostmangiato_Tick(object sender, EventArgs e)
ghostmangiato.Enabled = false;
pacman.Image = Properties.Resources.pacmorto;
for (int i = 0; i < 332; i++)
if (((Label)oggetti[i]).Visible == true && pacman.Bounds.IntersectsWith(((Label)oggetti[i]).Bounds))
((Label)oggetti[i]).Visible = false;
score.Text = point.ToString();
if (point >= 332) { finepartita(); label141.Visible = true; }
private void finepartita()
powermod1.Enabled = false;
powermod.Enabled = false;
private void freedirection()
pacman.Image = Properties.Resources.pacdx;
pacman.Image = Properties.Resources.pacsx;
pacman.Image = Properties.Resources.pacdown;
pacman.Image = Properties.Resources.pacup;
private void leftright(int i, int y, int n, int m)
if (Supermod1 && !ghost1puomangiare)
if (ghost1.Left < 180 && ghost1.Top == 150 || ghost1.Left > 170 && ghost1.Top == 150) { ghost1velocity = 2; Supermod1 = false; v1 = false; ghost1puomangiare = true; g1mangiato = false; }
if (ghost1.Top < 150) { if (n == 1 && m == 1) n = 0; }
if (ghost1.Top > 150) { if (n == 1 && m == 1) m = 0; }
if (ghost1.Left < 176) { if (i == 1 && y == 1) i = 0; }
if (ghost1.Left > 176) { if (i == 1 && y == 1) y = 0; }
random1 = rand.Next(1, 5);
if (random1 == 1 && !dir1 && random1 != prec1) if (i == 1) { leftghost1 = -ghost1velocity; dir1 = true; if (!Supermod1 && ghost1puomangiare) ghost1.Image = Properties.Resources.rsx; else if (!tresec || g1mangiato) { if (!tresec) ghost1.Image = Properties.Resources.crazy; if(g1mangiato) ghost1.Image = Properties.Resources.msx; } else ghost1.Image = Properties.Resources.tempo; }
if (random1 == 2 && !dir1 && random1 != prec1) if (y == 1) { leftghost1 = ghost1velocity; dir1 = true; if (!Supermod1 && ghost1puomangiare) ghost1.Image = Properties.Resources.rdx; else if (!tresec || g1mangiato) { if (!tresec) ghost1.Image = Properties.Resources.crazy; if (g1mangiato) ghost1.Image = Properties.Resources.mdx; } else ghost1.Image = Properties.Resources.tempo; }
if (random1 == 3 && !dir1 && random1 != prec1) if (m == 1) { topghost1 = ghost1velocity; dir1 = true; if (!Supermod1 && ghost1puomangiare) ghost1.Image = Properties.Resources.rdown; else if (!tresec || g1mangiato) { if (!tresec) ghost1.Image = Properties.Resources.crazy; if (g1mangiato) ghost1.Image = Properties.Resources.mdown; } else ghost1.Image = Properties.Resources.tempo; }
if (random1 == 4 && !dir1 && random1 != prec1) if (n == 1) { topghost1 = -ghost1velocity; dir1 = true; if (!Supermod1 && ghost1puomangiare ) ghost1.Image = Properties.Resources.rup; else if (!tresec || g1mangiato) { if (!tresec) ghost1.Image = Properties.Resources.crazy; if (g1mangiato) ghost1.Image = Properties.Resources.mup1; } else ghost1.Image = Properties.Resources.tempo; }
if (random1 == 1) prec1 = 2;
if (random1 == 2) prec1 = 1;
if (random1 == 3) prec1 = 4;
if (random1 == 4) prec1 = 3;
if (Supermod2 && !ghost2puomangiare)
if (ghost2.Left < 180 && ghost2.Top == 150 || ghost2.Left > 170 && ghost2.Top == 150) { ghost2velocity = 2; Supermod2 = false; v2 = false; ghost2puomangiare = true; g2mangiato = false; }
if (ghost2.Top < 150) { if (n == 1 && m == 1) n = 0; }
if (ghost2.Top > 150) { if (n == 1 && m == 1) m = 0; }
if (ghost2.Left < 176) { if (i == 1 && y == 1) i = 0; }
if (ghost2.Left > 176) { if (i == 1 && y == 1) y = 0; }
random2 = rand.Next(1, 5);
if (random2 == 1 && !dir2 && random2 != prec2) if (i == 1) { leftghost2 = -ghost2velocity; dir2 = true; if (!Supermod2 && ghost2puomangiare ) ghost2.Image = Properties.Resources.asx; else if(!tresec || g2mangiato) { if (!tresec) ghost2.Image = Properties.Resources.crazy; if (g2mangiato) ghost2.Image = Properties.Resources.msx; } else ghost2.Image = Properties.Resources.tempo; }
if (random2 == 2 && !dir2 && random2 != prec2) if (y == 1) { leftghost2 = ghost2velocity; dir2 = true; if (!Supermod2 && ghost2puomangiare ) ghost2.Image = Properties.Resources.adx; else if (!tresec || g2mangiato) { if (!tresec) ghost2.Image = Properties.Resources.crazy; if (g2mangiato) ghost2.Image = Properties.Resources.mdx; } else ghost2.Image = Properties.Resources.tempo; }
if (random2 == 3 && !dir2 && random2 != prec2) if (m == 1) { topghost2 = ghost2velocity; dir2 = true; if (!Supermod2 && ghost2puomangiare ) ghost2.Image = Properties.Resources.adown; else if (!tresec || g2mangiato) { if (!tresec) ghost2.Image = Properties.Resources.crazy; if (g2mangiato) ghost2.Image = Properties.Resources.mdown; } else ghost2.Image = Properties.Resources.tempo; }
if (random2 == 4 && !dir2 && random2 != prec2) if (n == 1) { topghost2 = -ghost2velocity; dir2 = true; if (!Supermod2 && ghost2puomangiare ) ghost2.Image = Properties.Resources.aup; else if (!tresec || g2mangiato) { if (!tresec) ghost2.Image = Properties.Resources.crazy; if (g2mangiato) ghost2.Image = Properties.Resources.mup1; } else ghost2.Image = Properties.Resources.tempo; }
if (random2 == 1) prec2 = 2;
if (random2 == 2) prec2 = 1;
if (random2 == 3) prec2 = 4;
if (random2 == 4) prec2 = 3;
if (Supermod3 && !ghost3puomangiare)
if (ghost3.Left < 180 && ghost3.Top == 150 || ghost3.Left > 170 && ghost3.Top == 150) { ghost3velocity = 2; Supermod3 = false; v3 = false; ghost3puomangiare = true; g3mangiato = false; }
if (ghost3.Top > 150) { if (n == 1 && m == 1) m = 0; }
if (ghost3.Top < 150) { if (n == 1 && m == 1) n = 0; }
if (ghost3.Left < 176) { if (i == 1 && y == 1) i = 0; }
if (ghost3.Left > 176) { if (i == 1 && y == 1) y = 0; }
random3 = rand.Next(1, 5);
if (random3 == 1 && !dir3 && random3 != prec3) if (i == 1) { leftghost3 = -ghost3velocity; dir3 = true; if (!Supermod3 && ghost3puomangiare) ghost3.Image = Properties.Resources.vsx; else if (!tresec || g3mangiato) { if (!tresec) ghost3.Image = Properties.Resources.crazy; if (g3mangiato) ghost3.Image = Properties.Resources.msx; } else ghost3.Image = Properties.Resources.tempo; }
if (random3 == 2 && !dir3 && random3 != prec3) if (y == 1) { leftghost3 = ghost3velocity; dir3 = true; if (!Supermod3 && ghost3puomangiare) ghost3.Image = Properties.Resources.vdx; else if (!tresec || g3mangiato) { if (!tresec) ghost3.Image = Properties.Resources.crazy; if (g3mangiato) ghost3.Image = Properties.Resources.mdx; } else ghost3.Image = Properties.Resources.tempo; }
if (random3 == 3 && !dir3 && random3 != prec3) if (m == 1) { topghost3 = ghost3velocity; dir3 = true; if (!Supermod3 && ghost3puomangiare) ghost3.Image = Properties.Resources.vdown; else if(!tresec || g3mangiato) { if (!tresec) ghost3.Image = Properties.Resources.crazy; if (g3mangiato) ghost3.Image = Properties.Resources.mdown; } else ghost3.Image = Properties.Resources.tempo; }
if (random3 == 4 && !dir3 && random3 != prec3) if (n == 1) { topghost3 = -ghost3velocity; dir3 = true; if (!Supermod3 && ghost3puomangiare) ghost3.Image = Properties.Resources.vup; else if (!tresec || g3mangiato) { if (!tresec) ghost3.Image = Properties.Resources.crazy; if (g3mangiato) ghost3.Image = Properties.Resources.mup1; } else ghost3.Image = Properties.Resources.tempo; }
if (random3 == 1) prec3 = 2;
if (random3 == 2) prec3 = 1;
if (random3 == 3) prec3 = 4;
if (random3 == 4) prec3 = 3;
if (Supermod4 && !ghost4puomangiare)
if (ghost4.Left < 180 && ghost4.Top == 150 || ghost4.Left > 170 && ghost4.Top == 150) { ghost4velocity = 2; Supermod4 = false; v4 = false; ghost4puomangiare = true; g4mangiato = false; }
if (ghost4.Top > 150) { if (n == 1 && m == 1) m = 0; }
if (ghost4.Top < 150) { if (n == 1 && m == 1) n = 0; }
if (ghost4.Left < 176) { if (i == 1 && y == 1) i = 0; }
if (ghost4.Left > 176) { if (i == 1 && y == 1) y = 0; }
random4 = rand.Next(1, 5);
if (random4 == 1 && !dir4 && random4 != prec4) if (i == 1) { leftghost4 = -ghost4velocity; dir4 = true; if (!Supermod4 && ghost4puomangiare) ghost4.Image = Properties.Resources.gsx; else if (!tresec || g4mangiato) { if (!tresec) ghost4.Image = Properties.Resources.crazy; if (g4mangiato) ghost4.Image = Properties.Resources.msx; } else ghost4.Image = Properties.Resources.tempo; }
if (random4 == 2 && !dir4 && random4 != prec4) if (y == 1) { leftghost4 = ghost4velocity; dir4 = true; if (!Supermod4 && ghost4puomangiare) ghost4.Image = Properties.Resources.gdx; else if (!tresec || g4mangiato) { if (!tresec) ghost4.Image = Properties.Resources.crazy; if (g4mangiato) ghost4.Image = Properties.Resources.mdx; } else ghost4.Image = Properties.Resources.tempo; }
if (random4 == 3 && !dir4 && random4 != prec4) if (m == 1) { topghost4 = ghost4velocity; dir4 = true; if (!Supermod4 && ghost4puomangiare) ghost4.Image = Properties.Resources.gdown; else if (!tresec || g4mangiato) { if (!tresec) ghost4.Image = Properties.Resources.crazy; if (g4mangiato) ghost4.Image = Properties.Resources.mdown; } else ghost4.Image = Properties.Resources.tempo; }
if (random4 == 4 && !dir4 && random4 != prec4) if (n == 1) { topghost4 = -ghost4velocity; dir4 = true; if (!Supermod4 && ghost4puomangiare) ghost4.Image = Properties.Resources.gup; else if (!tresec || g4mangiato) { if (!tresec) ghost4.Image = Properties.Resources.crazy; if (g4mangiato) ghost4.Image = Properties.Resources.mup1; } else ghost4.Image = Properties.Resources.tempo; }
if (random4 == 1) prec4 = 2;
if (random4 == 2) prec4 = 1;
if (random4 == 3) prec4 = 4;
if (random4 == 4) prec4 = 3;
if (temp == 1 && i == 1 || temp == 2 && y == 1 || temp == 3 && n == 1 || temp == 4 && m == 1)
pacman.Image = Properties.Resources.pacsx;
pacman.Image = Properties.Resources.pacdx;
pacman.Image = Properties.Resources.pacup;
pacman.Image = Properties.Resources.pacdown;
if (top == 0 && left == 0)
if (next == 1) pacman.Image = Properties.Resources._1sx;
if (next == 2) pacman.Image = Properties.Resources._1dx;
if (next == 3) pacman.Image = Properties.Resources._1up;
if (next == 4) pacman.Image = Properties.Resources._1down;
a(pacman.Left, pacman.Top);
private void a(int left, int top)
if (top == 148) { leftright(1, 1, 0, 0); break; }
if (top == 364) { leftright(0, 1, 1, 0); break; }
if (top == 328) { leftright(0, 1, 0, 1); break; }
if (top == 292) { leftright(0, 1, 1, 0); break; }
if (top == 256) { leftright(0, 1, 0, 1); break; }
if (top == 112) { leftright(0, 1, 1, 0); break; }
if (top == 76) { leftright(0, 1, 1, 1); break; }
if (top == 28) { leftright(0, 1, 0, 1); break; }
if (top == 328) { leftright(1, 1, 1, 0); break; }
if (top == 292) { leftright(1, 0, 0, 1); break; }
if (top == 256) { leftright(1, 1, 1, 1); break; }
if (top == 328) { leftright(1, 0, 1, 0); break; }
if (top == 292) { leftright(0, 1, 1, 1); break; }
if (top == 184) { leftright(1, 1, 1, 1); break; }
if (top == 112) { leftright(1, 0, 1, 1); break; }
if (top == 28) { leftright(1, 1, 0, 1); break; }
if (top == 76) { leftright(1, 1, 1, 1); break; }
if (top == 292) { leftright(1, 1, 0, 1); break; }
if (top == 328) { leftright(0, 1, 1, 0); break; }
if (top == 256) { leftright(1, 1, 1, 0); break; }
if (top == 220) { leftright(0, 1, 1, 1); break; }
if (top == 76) { leftright(1, 1, 0, 1); break; }
if (top == 112) { leftright(0, 1, 1, 0); break; }
if (top == 148) { leftright(0, 1, 0, 1); break; }
if (top == 184) { leftright(1, 0, 1, 1); break; }
if (top == 328) { leftright(1, 0, 0, 1); break; }
if (top == 364) { leftright(1, 1, 1, 0); break; }
if (top == 256) { leftright(1, 0, 0, 1); break; }
if (top == 292) { leftright(1, 1, 1, 0); break; }
if (top == 76) { leftright(1, 1, 1, 0); break; }
if (top == 112) { leftright(1, 0, 0, 1); break; }
if (top == 148) { leftright(1, 1, 1, 0); break; }
if (top == 28) { leftright(1, 0, 0, 1); break; }
if (top == 292) { leftright(1, 1, 1, 0); break; }
if (top == 256) { leftright(0, 1, 0, 1); break; }
if (top == 364) { leftright(1, 1, 1, 0); break; }
if (top == 328) { leftright(0, 1, 0, 1); break; }
if (top == 28) { leftright(0, 1, 0, 1); break; }
if (top == 76) { leftright(1, 1, 1, 0); break; }
if (top == 112) { leftright(0, 1, 0, 1); break; }
if (top == 148) { leftright(1, 1, 1, 0); break; }
if (top == 256) { leftright(1, 1, 1, 0); break; }
if (top == 328) { leftright(1, 0, 1, 0); break; }
if (top == 292) { leftright(1, 1, 0, 1); break; }
if (top == 220) { leftright(1, 0, 1, 1); break; }
if (top == 184) { leftright(0, 1, 1, 1); break; }
if (top == 76) { leftright(1, 1, 0, 1); break; }
if (top == 112) { leftright(1, 0, 1, 0); break; }
if (top == 148) { leftright(1, 0, 0, 1); break; }
if (top == 256) { leftright(1, 1, 1, 1); break; }
if (top == 292) { leftright(1, 0, 1, 1); break; }
if (top == 328) { leftright(0, 1, 1, 0); break; }
if (top == 184) { leftright(1, 1, 1, 1); break; }
if (top == 112) { leftright(0, 1, 1, 1); break; }
if (top == 28) { leftright(1, 1, 0, 1); break; }
if (top == 76) { leftright(1, 1, 1, 1); break; }
if (top == 256) { leftright(1, 0, 0, 1); break; }
if (top == 292) { leftright(1, 0, 1, 0); break; }
if (top == 328) { leftright(1, 0, 0, 1); break; }
if (top == 364) { leftright(1, 0, 1, 0); break; }
if (top == 112) { leftright(1, 0, 1, 0); break; }
if (top == 76) { leftright(1, 0, 1, 1); break; }
if (top == 28) { leftright(1, 0, 0, 1); break; }
if (top == 292) { leftright(0, 1, 0, 1); break; }
if (top == 328) { leftright(1, 1, 1, 0); break; }
if (top == 184) { transport(0, 1); break; }
if (top == 184) { transport(1, 0); break; }
if (top == 150) { leftright(1, 1, 0, 0); break; }
if (top == 366) { leftright(0, 1, 1, 0); break; }
if (top == 330) { leftright(0, 1, 0, 1); break; }
if (top == 294) { leftright(0, 1, 1, 0); break; }
if (top == 258) { leftright(0, 1, 0, 1); break; }
if (top == 114) { leftright(0, 1, 1, 0); break; }
if (top == 78) { leftright(0, 1, 1, 1); break; }
if (top == 30) { leftright(0, 1, 0, 1); break; }
if (top == 330) { leftright(1, 1, 1, 0); break; }
if (top == 294) { leftright(1, 0, 0, 1); break; }
if (top == 258) { leftright(1, 1, 1, 1); break; }
if (top == 330) { leftright(1, 0, 1, 0); break; }
if (top == 294) { leftright(0, 1, 1, 1); break; }
if (top == 186) { leftright(1, 1, 1, 1); break; }
if (top == 114) { leftright(1, 0, 1, 1); break; }
if (top == 30) { leftright(1, 1, 0, 1); break; }
if (top == 78) { leftright(1, 1, 1, 1); break; }
if (top == 294) { leftright(1, 1, 0, 1); break; }
if (top == 330) { leftright(0, 1, 1, 0); break; }
if (top == 258) { leftright(1, 1, 1, 0); break; }
if (top == 222) { leftright(0, 1, 1, 1); break; }
if (top == 78) { leftright(1, 1, 0, 1); break; }
if (top == 114) { leftright(0, 1, 1, 0); break; }
if (top == 150) { leftright(0, 1, 0, 1); break; }
if (top == 186) { leftright(1, 0, 1, 1); break; }
if (top == 330) { leftright(1, 0, 0, 1); break; }
if (top == 366) { leftright(1, 1, 1, 0); break; }
if (top == 258) { leftright(1, 0, 0, 1); break; }
if (top == 294) { leftright(1, 1, 1, 0); break; }
if (top == 78) { leftright(1, 1, 1, 0); break; }
if (top == 114) { leftright(1, 0, 0, 1); break; }
if (top == 150) { leftright(1, 1, 1, 0); break; }
if (top == 30) { leftright(1, 0, 0, 1); break; }
if (top == 294) { leftright(1, 1, 1, 0); break; }
if (top == 258) { leftright(0, 1, 0, 1); break; }
if (top == 366) { leftright(1, 1, 1, 0); break; }
if (top == 330) { leftright(0, 1, 0, 1); break; }
if (top == 30) { leftright(0, 1, 0, 1); break; }
if (top == 78) { leftright(1, 1, 1, 0); break; }
if (top == 114) { leftright(0, 1, 0, 1); break; }
if (top == 150) { leftright(1, 1, 1, 0); break; }
if (top == 258) { leftright(1, 1, 1, 0); break; }
if (top == 330) { leftright(1, 0, 1, 0); break; }
if (top == 294) { leftright(1, 1, 0, 1); break; }
if (top == 222) { leftright(1, 0, 1, 1); break; }
if (top == 186) { leftright(0, 1, 1, 1); break; }
if (top == 78) { leftright(1, 1, 0, 1); break; }
if (top == 114) { leftright(1, 0, 1, 0); break; }
if (top == 150) { leftright(1, 0, 0, 1); break; }
if (top == 258) { leftright(1, 1, 1, 1); break; }
if (top == 294) { leftright(1, 0, 1, 1); break; }
if (top == 330) { leftright(0, 1, 1, 0); break; }
if (top == 186) { leftright(1, 1, 1, 1); break; }
if (top == 114) { leftright(0, 1, 1, 1); break; }
if (top == 30) { leftright(1, 1, 0, 1); break; }
if (top == 78) { leftright(1, 1, 1, 1); break; }
if (top == 258) { leftright(1, 0, 0, 1); break; }
if (top == 294) { leftright(1, 0, 1, 0); break; }
if (top == 330) { leftright(1, 0, 0, 1); break; }
if (top == 366) { leftright(1, 0, 1, 0); break; }
if (top == 114) { leftright(1, 0, 1, 0); break; }
if (top == 78) { leftright(1, 0, 1, 1); break; }
if (top == 30) { leftright(1, 0, 0, 1); break; }
if (top == 294) { leftright(0, 1, 0, 1); break; }
if (top == 330) { leftright(1, 1, 1, 0); break; }
if (top == 186) { transport(0, 1); break; }
if (top == 186) { transport(1, 0); break; }
private void transport(int i, int n)
if (i == 0) pacman.Left = -26;
if (n == 0) pacman.Left = 374;
if (i == 0) ghost1.Left = -26;
if (n == 0) ghost1.Left = 374;
if (i == 0) ghost2.Left = -26;
if (n == 0) ghost2.Left = 374;
if (i == 0) ghost3.Left = -26;
if (n == 0) ghost3.Left = 374;
if (i == 0) ghost4.Left = -26;
if (n == 0) ghost4.Left = 374;
if (ghost1.Enabled == true)
ghost1.Left += leftghost1;
a(ghost1.Left, ghost1.Top);
if (ghost2.Enabled == true)
ghost2.Left += leftghost2;
a(ghost2.Left, ghost2.Top);
if (ghost3.Enabled == true)
ghost3.Left += leftghost3;
a(ghost3.Left, ghost3.Top);
if (ghost4.Enabled == true)
ghost4.Left += leftghost4;
a(ghost4.Left, ghost4.Top);