private void ControlsForm_FormClosed(object sender, FormClosedEventArgs e) { StartForm forma = new StartForm(); forma.Show(); this.Hide(); }
private void timer1_Tick(object sender, EventArgs e) { if (!isPaused) { if (igra.GameOver == true && !modalno) { isPaused = true; // igra = new Game(this.Bounds.Width, this.Bounds.Height); DialogResult rez = MessageBox.Show("Score:" + igra.Score.ToString() + "\n" + "Сакаш да се обидеш повторно?", "Game Over", MessageBoxButtons.YesNo); modalno = true; if (rez == DialogResult.Yes) { modalno = false; igra = new Game(this.Bounds.Width, this.Bounds.Height); isPaused = false; } else { modalno = false; isPaused = false; StartForm form = new StartForm(); form.Show(); timer1.Stop(); this.Hide(); } } else { igra.Update(); } Invalidate(true); } }
private void button1_Click(object sender, EventArgs e) { StartForm form = new StartForm(); form.Show(); this.Hide(); }
private void Form1_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Right) { mvRight.Stop(); } else if (e.KeyCode == Keys.Left) { mvLeft.Stop(); } else if (e.KeyCode == Keys.Escape) { isPaused = true; DialogResult result = MessageBox.Show("Сакаш ли да се вратиш назад?", "Потврда", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { StartForm form = new StartForm(); form.Show(); this.Hide(); isPaused = false; } else if (result == DialogResult.No) { isPaused = false; } } }