private void bestenlisteToolStripMenuItem_Click(object sender, EventArgs e) { bool weiter = false; if (spielPause == false) { pauseToolStripMenuItem_Click(sender, e); weiter = true; } Ball.Hide(); Schlaeger.Hide(); spielpunkte.ListeAusgeben(zeichenflaeche, spielfeldGroesse); System.Threading.Thread.Sleep(4000); zeichenflaeche.Clear(panelFeld.BackColor); Ball.Show(); Schlaeger.Show(); if (weiter == true) { pauseToolStripMenuItem_Click(sender, e); } }
private void timerSpielZeit_Tick(object sender, EventArgs e) { pauseToolStripMenuItem_Click(sender, e); if (spielpunkte.NeuerEintrag() == true) { Ball.Hide(); Schlaeger.Hide(); spielpunkte.ListeAusgeben(zeichenflaeche, spielfeldGroesse); System.Threading.Thread.Sleep(1000); zeichenflaeche.Clear(farbeHintergrund); Ball.Show(); Schlaeger.Show(); } MessageBox.Show("Die Zeit ist OVER!", "Game Over!", MessageBoxButtons.OK, MessageBoxIcon.Information); if (neuseSpiel() == true) { pauseToolStripMenuItem_Click(sender, e); } else { competitionToolStripMenuItem.Enabled = true; zeichenflaeche = panelFeld.CreateGraphics(); panelFeld.BackColor = farbeHintergrund; setzeSpielfeld(); neuerBall(); pauseToolStripMenuItem.Checked = false; einstellungenToolStripMenuItem.Enabled = false; } }
static Game() { random = new Random(); ball = new Ball(GameForm.GameBoard); location = new Point(_size + 5, random.Next(GameForm.GameBoard.Height - _size)); vector = new Point(random.Next(3, 9), random.Next(-8, 8)); ball.SetPosition(location, vector); ball.Hide(); moveDelay = new Timer(); moveDelay.Tick += new EventHandler(MoveOnTick); moveDelay.Interval = 10; }
public static void Win(int player) { GlobalVariables.speed = 5; switch (player) { case 1: p1Score++; break; case 2: p2Score++; break; } moveDelay.Stop(); ball.Hide(); GlobalVariables.p1.Hide(); GlobalVariables.p2.Hide(); StartGame(); }
static GameHandler() { location = new Point(GlobalVariables.ballSize * 3, random.Next(GlobalVariables.ballSize, GlobalVariables.gB.Height) - GlobalVariables.ballSize); vector = new Point(random.Next(4, 6), random.Next(0, 5)); ball = new Ball(GlobalVariables.gB); ball.Hide(); GlobalVariables.p1 = new PlayerControls(GlobalVariables.gB, new Point(1, GlobalVariables.gB.Height / 4)); GlobalVariables.p2 = new PlayerControls(GlobalVariables.gB, new Point(GlobalVariables.gB.Width - 41, GlobalVariables.gB.Height / 4)); GlobalVariables.p1.Hide(); GlobalVariables.p2.Hide(); moveDelay = new Timer(); moveDelay.Tick += new EventHandler(MoveOnTick); moveDelay.Interval = 30; matchDelay = new Timer(); matchDelay.Tick += new EventHandler(ShowTimer); matchDelay.Interval = 800; }
public static void Win(int player) { moveDelay.Stop(); ball.Hide(); GameForm.GameBoardForm.OnWin(player); }