public void ShowGameOver() { Invoke((MethodInvoker)(() => { GameOverLabel.Text = "You deaded"; GameOverLabel.Show(); })); }
private void GameOver() { mainTimer.Stop(); GameOverLabel.BackColor = Color.Transparent; GameOverLabel.Parent = level; GameOverLabel.Visible = true; GameOverLabel.BringToFront(); }
private void Form1_Load(object sender, EventArgs e) { Timer_Game.Start(); HideBlock(); YouWinLabel.Hide(); GameOverLabel.Hide(); }
public void GameOver(int points) //вывод результатов игры { m_gameMusic.Stop(); m_endMusic.PlayLooping(); GameOverLabel.Show(); RetryButton.Show(); ExitButton.Show(); MartianBattleLabel.Show(); PointsLabel.Text = "POINTS: " + points.ToString(); PointsLabel.Show(); }
private void RetryButtonHandler(object sender, EventArgs e) //кнопка повторного запуска игры { //скрытие всех лишних элементов формы GameOverLabel.Hide(); RetryButton.Hide(); ExitButton.Hide(); MartianBattleLabel.Hide(); PointsLabel.Hide(); NumbersOfLives.Value = 100; m_endMusic.Stop(); m_gameMusic.PlayLooping(); m_controlGame.StartGame(); //повторный запуск игры }
public GameWindow() { this.KeyPreview = true; InitializeComponent(); //sound ~ BGM.wav file is on the same folder as the application .exe string directory = AppDomain.CurrentDomain.BaseDirectory; string fullpath = Path.Combine(directory, "BGM.wav"); if (File.Exists(fullpath)) { System.Media.SoundPlayer bgm = new System.Media.SoundPlayer(fullpath); bgm.PlayLooping(); } GameOverLabel.Hide(); Ready_Go_Label.Left = (Size.Width - Ready_Go_Label.Width) / 2; invader.Left = -invader.Width; bullet.Left = -bullet.Width; }
private void keyisdown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Left) { goleft = true; } if (e.KeyCode == Keys.Right) { goright = true; } if (e.KeyCode == Keys.Space && !isPressed) { isPressed = true; } if (e.KeyCode == Keys.Enter && (Ready_Go_Label.Visible || GameOverLabel.Visible)) { Ready_Go_Label.Hide(); GameOverLabel.Hide(); setGame(); timer1.Enabled = true; } }
protected override void OnRenderFrame(FrameEventArgs E) { base.OnRenderFrame(E); var Modelview = Matrix4.LookAt(Vector3.Zero, Vector3.UnitZ, Vector3.UnitY); GL.MatrixMode(MatrixMode.Modelview); GL.LoadMatrix(ref Modelview); RenderBackground(); var PipeMarginY = (ProjectionHeight - MapHeight * SolidSize) / 2f; var PipeMarginX = (NominalHeight - MapHeight * SolidSize) / 2f; var Overwidth = ProjectionWidth - ProjectionHeight * (float)NominalWidth / NominalHeight; if (Overwidth > 0) { GL.Translate(Math.Min(Overwidth, (ProjectionWidth - MapWidth * SolidSize) / 2f), PipeMarginY, 0); } else { GL.Translate(PipeMarginX, PipeMarginY, 0); } RenderPipe(); for (var X = 0; X < MapWidth; X++) { for (var Y = 0; Y < MapHeight; Y++) { if (Map[X, Y] >= 0) { RenderSolid(X, Y + ImpactFallOffset[X, Y], Map[X, Y]); } } } if (GameStateEnum.Fall == GameState) { for (var i = 0; i < StickLength; i++) { if (StickColors[i] >= 0) { RenderSolid(StickPosition.X + i, StickPosition.Y, StickColors[i]); } } } GL.Translate(MapWidth * SolidSize + PipeMarginX, 0, 0); NextStickLabel.Render(); GL.Translate(0, NextStickLabel.Height, 0); RenderNextStick(); GL.Translate(0, -NextStickLabel.Height, 0); GL.Translate(0, MapHeight * SolidSize / 4f, 0); if (GameStateEnum.GameOver == GameState) { GameOverLabel.Render(); GL.Translate(0, GameOverLabel.Height, 0); GameOverHint.Render(); GL.Translate(0, -GameOverLabel.Height, 0); } else if (Paused) { PauseLabel.Render(); GL.Translate(0, PauseLabel.Height, 0); UnpauseHint.Render(); GL.Translate(0, -PauseLabel.Height, 0); } else { PlayingGameLabel.Render(); GL.Translate(0, PlayingGameLabel.Height, 0); PauseHint.Render(); GL.Translate(0, -PlayingGameLabel.Height, 0); } GL.Translate(0, MapHeight * SolidSize / 4f, 0); ScoreLabel.Render(); GL.Translate(0, ScoreLabel.Height, 0); ScoreRenderer.Label = Score.ToString(); ScoreRenderer.Render(); GL.Translate(0, -ScoreLabel.Height, 0); GL.Translate(0, MapHeight * SolidSize / 4f, 0); HighScoreLabel.Render(); GL.Translate(0, HighScoreLabel.Height, 0); HighScoreRenderer.Label = HighScore.ToString(); HighScoreRenderer.Render(); SwapBuffers(); }
private void timer1_Tick(object sender, EventArgs e) { if (game.isGameOver()) { GameOverLabel.Show(); Ready_Go_Label.Show(); if (game.GetEnemies().Count == 0) { GameOverLabel.Text = "YOU WIN"; } else { GameOverLabel.Text = "GAME OVER"; } GameOverLabel.Left = (this.Width - GameOverLabel.Width) / 2; Ready_Go_Label.Text = "Press Enter to Restart"; Ready_Go_Label.Left = (this.Width - Ready_Go_Label.Width) / 2; return; } game.Update(goleft, goright, isPressed); List <Enemy> en = game.GetEnemies(); List <Bullet> bull = game.GetBullets(); int Ecount = 0; int Bcount = 0; foreach (Control c in this.Controls) { if (c is PictureBox && (string)c.Tag == "player") { int x, y; game.GetPlayerPos(out x, out y); ((PictureBox)c).Top = y; //((PictureBox)c).Height * y; ((PictureBox)c).Left = x; // ((PictureBox)c).Width * x; } if (c is PictureBox && (string)c.Tag == "invader") { if (Ecount >= en.Count) { //remove from form this.Controls.Remove(c); //release memory by disposing c.Dispose(); break; } int x, y; en[Ecount].GetPos(out x, out y); ((PictureBox)c).Top = y; // ((PictureBox)c).Height * y; ((PictureBox)c).Left = x; // ((PictureBox)c).Width * x; Ecount++; } if (c is PictureBox && (string)c.Tag == "bullet") { if (bull.Count > Bcount) { int x, y; bull[Bcount].GetPos(out x, out y); ((PictureBox)c).Top = y; // ((PictureBox)c).Height * y; ((PictureBox)c).Left = x; // ((PictureBox)c).Width * x; Bcount++; } else { ((PictureBox)c).Top = -((PictureBox)c).Height; ((PictureBox)c).Left = -((PictureBox)c).Width; } } } while (bull.Count > Bcount) { int x, y; bull[Bcount].GetPos(out x, out y); createBullet(Bcount, x, y); Bcount++; } labelLives.Text = "lives: " + game.getLives().ToString(); }
//Option Manager void fail() { GameOverLabel.Show(); spaceHandle = false; //Application.Restart(); }