public void Start() { if (!startStop) { if (animazioneStartStop) { velocitàAnimazioneTimer.StartP(); } if (afraidStartStop) { velocitàAnimazioneAfraidTimer.StartP(); afraidTimeTimer.StartP(); } if (afraidEndStartStop) { velocitàAnimazioneAfraidEndTimer.StartP(); afraidTimeEndTimer.StartP(); } if (afraidEndInvertStartStop) { afraidTimeEndInvertTimer.StartP(); } if (muoriStartStop) { velocitàAnimazioneMuoriTimer.StartP(); } startStop = true; } }
public void pausePlayMouseClick(object sender, EventArgs e) { if (!gameOver_) { if (pausaPlay == 0) { mappa.Pause(); this.Parent.Controls.Add(lbl_Pause); destraSinistra = 5; this.Parent.Controls.Add(pausePlay); pausePlay.Location = new Point(0, 30); sposta.StartP(); pausaPlay = 1; } else { destraSinistra = -5; sposta.StartP(); pausaPlay = 0; if (infoActive) { info.TabIndex += info.TabIndex % 2 == 0 ? 1 : -1; } } if (sender == null) { pausePlay.Image = imagePausePlay[pausaPlay, 0]; } else { pausePlay.Image = imagePausePlay[pausaPlay, 1]; } } }
public void Start() { if (!startPause) { if (vivoMorto) { velocitàAnimazione.StartP(); } else { velocitàAnimazioneMorte.StartP(); } startPause = true; } }
private void lbl_info_Click(object sender, EventArgs e) { if (destraSinistraInfo < 0) { gioco.infoActive = false; destraSinistraInfo = 5; spostaInfo.StartP(); gioco.Start(); } else { gioco.infoActive = true; destraSinistraInfo = -5; spostaInfo.StartP(); gioco.Pause(); } }
public void Start() { if (!ripristina) { pacmanSpeed_.StartP(); pacman.Start(); for (int i = 0; i < ghosts.Length; i++) { ghosts[i].Start(); datiGhosts[i].speed.StartP(); if (!datiGhosts[i].vivoMorto) { datiGhosts[i].durataMorte.StartP(); } } } else { ritardoRipristina.StartP(); } }
private void Pic_Setting_Click(object sender, EventArgs e) { if (sopraSottoImpostazioni == -5) { sopraSottoImpostazioni = 5; impostazioni.Enabled = true; } else { sopraSottoImpostazioni = -5; impostazioni.Enabled = false; } spostaImpostazioni.StartP(); }
public MainPacman() { InitializeComponent(); IncorporaFont(17f, lbl_Close.Font.Style); eat_ghostPlayer.Load(); eat_pillPlayer.Load(); eat_powPlayer.Load(); mortoPlayer.Load(); riderePlayer.Load(); startPlayer.Load(); extra_livesPlayer.Load(); lbl_Close.Font = new System.Drawing.Font(MyFontFamily, 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); #region dati List <int[]> zonaNavigabileOrizzontale = new List <int[]>(); List <int[]> zonaNavigabileVerticale = new List <int[]>(); List <int[]> pilloleOrizzontale = new List <int[]>(); List <int[]> pilloleVerticale = new List <int[]>(); List <int[]> pilloleSpeciali = new List <int[]>(); zonaNavigabileOrizzontale.Add(new int[] { 12, 12, 162, 203, 354 }); zonaNavigabileOrizzontale.Add(new int[] { 66, 12, 354 }); zonaNavigabileOrizzontale.Add(new int[] { 107, 12, 80, 121, 162, 203, 244, 285, 354 }); zonaNavigabileOrizzontale.Add(new int[] { 149, 121, 244 }); zonaNavigabileOrizzontale.Add(new int[] { 190, -22, 121, 244, 387 }); zonaNavigabileOrizzontale.Add(new int[] { 231, 121, 244 }); zonaNavigabileOrizzontale.Add(new int[] { 272, 12, 162, 203, 354 }); zonaNavigabileOrizzontale.Add(new int[] { 313, 12, 38, 80, 285, 327, 354 }); zonaNavigabileOrizzontale.Add(new int[] { 354, 12, 80, 121, 162, 203, 244, 285, 354 }); zonaNavigabileOrizzontale.Add(new int[] { 395, 12, 354 }); zonaNavigabileVerticale.Add(new int[] { 12, 12, 107, 272, 313, 354, 395 }); zonaNavigabileVerticale.Add(new int[] { 38, 313, 354 }); zonaNavigabileVerticale.Add(new int[] { 80, 12, 354 }); zonaNavigabileVerticale.Add(new int[] { 121, 66, 107, 149, 272, 313, 354 }); zonaNavigabileVerticale.Add(new int[] { 162, 12, 66, 107, 149, 272, 313, 354, 395 }); zonaNavigabileVerticale.Add(new int[] { 203, 12, 66, 107, 149, 272, 313, 354, 395 }); zonaNavigabileVerticale.Add(new int[] { 244, 66, 107, 149, 272, 313, 354 }); zonaNavigabileVerticale.Add(new int[] { 285, 12, 354 }); zonaNavigabileVerticale.Add(new int[] { 327, 313, 354 }); zonaNavigabileVerticale.Add(new int[] { 354, 12, 107, 272, 313, 354, 395 }); pilloleOrizzontale.Add(new int[] { 21, 21, 185, 12, 213, 378, 12 }); pilloleOrizzontale.Add(new int[] { 76, 21, 378, 26 }); pilloleOrizzontale.Add(new int[] { 117, 21, 102, 6, 130, 186, 4, 213, 268, 4, 296, 378, 6 }); pilloleOrizzontale.Add(new int[] { 281, 21, 185, 12, 213, 378, 12 }); pilloleOrizzontale.Add(new int[] { 322, 34, 62, 2, 89, 185, 7, 213, 309, 7, 336, 364, 2 }); pilloleOrizzontale.Add(new int[] { 364, 21, 102, 6, 130, 186, 4, 213, 268, 4, 296, 378, 6 }); pilloleOrizzontale.Add(new int[] { 405, 21, 378, 26 }); pilloleVerticale.Add(new int[] { 21, 35, 35, 1, 62, 62, 1, 89, 117, 2, 295, 322, 2, 377, 405, 2 }); pilloleVerticale.Add(new int[] { 48, 336, 364, 2 }); pilloleVerticale.Add(new int[] { 89, 35, 76, 3, 89, 117, 2, 131, 281, 11, 295, 322, 2, 336, 364, 2 }); pilloleVerticale.Add(new int[] { 130, 89, 117, 2, 336, 364, 2 }); pilloleVerticale.Add(new int[] { 172, 34, 76, 3, 295, 323, 2, 377, 405, 2 }); pilloleVerticale.Add(new int[] { 213, 34, 76, 3, 295, 323, 2, 377, 405, 2 }); pilloleVerticale.Add(new int[] { 255, 89, 117, 2, 336, 364, 2 }); pilloleVerticale.Add(new int[] { 296, 35, 76, 3, 89, 117, 2, 131, 281, 11, 295, 322, 2, 336, 364, 2 }); pilloleVerticale.Add(new int[] { 336, 336, 364, 2 }); pilloleVerticale.Add(new int[] { 365, 35, 35, 1, 62, 62, 1, 89, 117, 2, 295, 322, 2, 377, 405, 2 }); pilloleSpeciali.Add(new int[] { 44, 17, 17, 1, 360, 360, 1 }); pilloleSpeciali.Add(new int[] { 317, 17, 17, 1, 360, 360, 1 }); int[,] zoneSpeciali = new int[, ] { { 387, 190, -22, 190, 2 }, { -22, 190, 387, 190, 0 } }; ghosts = new Ghost[4]; datiGhosts = new datiGhost[4]; ghosts[0] = new Ghost("blinky", 0, 60, 7000, 3000, 250); datiGhosts[0].speed = new Timer(); datiGhosts[0].speedIniziale = datiGhosts[0].speed.Intervallo = 32; datiGhosts[0].durataMorte = new Timer(); datiGhosts[0].durataMorte.Intervallo = 5000; datiGhosts[0].durataMorte.Tag = datiGhosts[0].speed.Tag = 0; datiGhosts[0].direzione = 0; datiGhosts[0].puntoPartenza = new Point(12, 12); ghosts[1] = new Ghost("inky", 0, 60, 7000, 3000, 250); datiGhosts[1].speed = new Timer(); datiGhosts[1].speedIniziale = datiGhosts[1].speed.Intervallo = 33; datiGhosts[1].durataMorte = new Timer(); datiGhosts[1].durataMorte.Intervallo = 5000; datiGhosts[1].durataMorte.Tag = datiGhosts[1].speed.Tag = 1; datiGhosts[1].direzione = 0; datiGhosts[1].puntoPartenza = new Point(354, 12); ghosts[2] = new Ghost("pinky", 0, 60, 7000, 3000, 250); datiGhosts[2].speed = new Timer(); datiGhosts[2].speedIniziale = datiGhosts[2].speed.Intervallo = 34; datiGhosts[2].durataMorte = new Timer(); datiGhosts[2].durataMorte.Intervallo = 5000; datiGhosts[2].durataMorte.Tag = datiGhosts[2].speed.Tag = 2; datiGhosts[2].direzione = 0; datiGhosts[2].puntoPartenza = new Point(12, 395); ghosts[3] = new Ghost("clyde", 0, 60, 7000, 3000, 250); datiGhosts[3].speed = new Timer(); datiGhosts[3].speedIniziale = datiGhosts[3].speed.Intervallo = 35; datiGhosts[3].durataMorte = new Timer(); datiGhosts[3].durataMorte.Intervallo = 5000; datiGhosts[3].durataMorte.Tag = datiGhosts[3].speed.Tag = 3; datiGhosts[3].direzione = 0; datiGhosts[3].puntoPartenza = new Point(354, 395); #endregion pacmanSpeed.Intervallo = 29; mappa = new Mappa(Properties.Resources.background, zonaNavigabileOrizzontale, zonaNavigabileVerticale, pacman, 190, 313, 0, pacmanSpeed, pilloleOrizzontale, pilloleVerticale, pilloleSpeciali, ghosts, ref datiGhosts, zoneSpeciali); mappa.incrementoPunteggio += new EventHandler(incrementoPunteggio); mappa.incrementoPunteggioSpeciale += new EventHandler(incrementoPunteggioSpeciale); mappa.mortePacman += mortePacman; mappa.morteGhost += incrementoPunteggioGhost; mappa.vinto += vinto; gioco = new Gioco(mappa, 2, lbl_info, MyFontFamily); this.Size = new Size(0, 0); this.Controls.Add(gioco); gioco.Location = new Point(0, 30); gioco.MouseDown += MainPacman_MouseDown; gioco.MouseUp += MainPacman_MouseUp; gioco.MouseMove += MainPacman_MouseMove; mappa.MouseDown += MainPacman_MouseDown; mappa.MouseUp += MainPacman_MouseUp; mappa.MouseMove += MainPacman_MouseMove; this.info = new Info(MyFontFamily); this.Controls.Add(this.info); this.info.Location = new Point(gioco.Size.Width, gioco.Size.Height - info.Size.Height + 30); this.info.BringToFront(); spostaInfo.Intervallo = 10; spostaInfo.Tick += spostaSinistraInfo; impostazioni = new Impostazioni(mappa, ref datiGhosts); this.Controls.Add(impostazioni); impostazioni.Location = new Point(0, -impostazioni.Size.Height); impostazioni.BringToFront(); spostaImpostazioni.Intervallo = 10; spostaImpostazioni.Tick += spostaSinistraImpostazioni; start.Tick += inizia; start.Intervallo = 10; start.StartP(); }