///////////////////////////////////// ///MENU //////REINICIAR////////////// ///////////////////////////////////// private void reiniciarToolStripMenuItem_Click(object sender, EventArgs e) { tiempo = 300; Time.Text = "Tiempo : " + tiempo; BarLv4.Value = 0; lv4 = 0; Comida.Text = "Ciraturas Comidas : " + lv4; ContadoresLv4.Stop(); MensajeInicio.Visible = true; CriaturaBox.Visible = false; }
///////////////////////////////////// ///CONTADORES = TIEMPO ////////////// ///////////////////////////////////// private void ContadoresLv4_Tick(object sender, EventArgs e) { tiempo--; Time.Text = "Tiempo : " + tiempo; if (tiempo == 0) { ContadoresLv4.Stop(); Defeat frm = new Defeat(); frm.Show(); } }
private void Nivel_4_KeyDown(object sender, KeyEventArgs e) { ///////////////////////////////////// ////MOVIMIENTO DEL MonstruoBox/////// ///////////////////////////////////// if ((e.KeyData == Keys.A) && (MonstruoBox.Location.X >= 0)) { MonstruoBox.Location = new Point(MonstruoBox.Location.X - 10, MonstruoBox.Location.Y); } if ((e.KeyData == Keys.D) && (MonstruoBox.Location.X <= 850)) { MonstruoBox.Location = new Point(MonstruoBox.Location.X + 10, MonstruoBox.Location.Y); } if ((e.KeyData == Keys.W) && (MonstruoBox.Location.Y >= 40)) { MonstruoBox.Location = new Point(MonstruoBox.Location.X, MonstruoBox.Location.Y - 15); } if ((e.KeyData == Keys.S) && (MonstruoBox.Location.Y <= 515)) { MonstruoBox.Location = new Point(MonstruoBox.Location.X, MonstruoBox.Location.Y + 15); } /////////////////////////////////// /////MOVIMIENTO DE LA CRIATURA///// /////////////////////////////////// if (CriaturaBox.Bounds.IntersectsWith(MonstruoBox.Bounds)) { Move_Criatura(); lv4 = lv4 + 30; Comida.Text = "Ciraturas Comidas : " + lv4; BarLv4.Increment(10); } if (lv4 == 30) { GameOver frm = new GameOver(); frm.Show(); ContadoresLv4.Stop(); } /////////////////////////////////// /////AVISOS EN LA PANTALLA///////// /////////////////////////////////// if (e.KeyData == Keys.Space) { CriaturaBox.Visible = true; ContadoresLv4.Start(); MensajeInicio.Visible = false; } }
///////////////////////////////////// ///MENU //////PAUSAR//////////////// ///////////////////////////////////// private void pausarToolStripMenuItem_Click(object sender, EventArgs e) { Cursor.Show(); if (pausarToolStripMenuItem.Text == "Pausar") { pausarToolStripMenuItem.Text = "Reanudar"; ContadoresLv4.Stop(); CriaturaBox.Visible = false; } else { if (pausarToolStripMenuItem.Text == "Reanudar") { pausarToolStripMenuItem.Text = "Pausar"; ContadoresLv4.Start(); CriaturaBox.Visible = true; } } }