///////////////////////////////////// ///MENU //////REINICIAR////////////// ///////////////////////////////////// private void reiniciarToolStripMenuItem_Click(object sender, EventArgs e) { tiempo = 0; Tiempo.Text = "Tiempo : " + tiempo; BarLv1.Value = 0; lv1 = 0; Comida.Text = "Ciraturas Comidas : " + lv1; Contadores.Stop(); MensajeInicio.Visible = true; CriaturaBox.Visible = false; }
public Nivel_2() { InitializeComponent(); Pierdes.Start(); Contadores.Stop(); ///////////////////////////////////// ////ARREGLO DE OBSTACULOS//////////// ///////////////////////////////////// for (int j = 0, y = 150; j < Obstaculos.GetLength(1); j++, y += 200) { for (int i = 0, x = 150; i < Obstaculos.GetLength(0); i++, x += 500) { Obstaculos[i, j] = new PictureBox(); ((System.ComponentModel.ISupportInitialize)(Obstaculos[i, j])).BeginInit(); this.SuspendLayout(); imagen = nroAleatorio.Next(3); if (imagen == 0) { Obstaculos[i, j].Image = global::Cho_2._0.Properties.Resources.Lago; } else { if (imagen == 1) { Obstaculos[i, j].Image = global::Cho_2._0.Properties.Resources.LagoClaro; } else { if (imagen == 2) { Obstaculos[i, j].Image = global::Cho_2._0.Properties.Resources.Lodo; } } } Obstaculos[i, j].Location = new System.Drawing.Point(x, y); Obstaculos[i, j].Name = "bloque" + i; Obstaculos[i, j].Size = new System.Drawing.Size(99, 42); Obstaculos[i, j].TabIndex = 0; Obstaculos[i, j].TabStop = true; Controls.Add(Obstaculos[i, j]); Obstaculos[i, j].Visible = true; Bloques[i, j] = new Rectangle(Obstaculos[i, j].Location.X, Obstaculos[i, j].Location.Y, Obstaculos[i, j].Width, Obstaculos[i, j].Height); } } }
///////////////////////////////////// ///MENU //////PAUSAR//////////////// ///////////////////////////////////// private void pausarToolStripMenuItem_Click(object sender, EventArgs e) { Cursor.Show(); if (pausarToolStripMenuItem.Text == "Pausar") { pausarToolStripMenuItem.Text = "Reanudar"; Contadores.Stop(); CriaturaBox.Visible = false; } else { if (pausarToolStripMenuItem.Text == "Reanudar") { pausarToolStripMenuItem.Text = "Pausar"; Contadores.Start(); CriaturaBox.Visible = true; } } }
private void Form1_KeyDown(object sender, KeyEventArgs e) { ///////////////////////////////////// ////MOVIMIENTO DEL MonstruoBox/////// ///////////////////////////////////// if ((e.KeyData == Keys.A) && (MonstruoBox.Location.X >= 0)) { MonstruoBox.Location = new Point(MonstruoBox.Location.X - 20, MonstruoBox.Location.Y); } if ((e.KeyData == Keys.D) && (MonstruoBox.Location.X <= 800)) { MonstruoBox.Location = new Point(MonstruoBox.Location.X + 20, MonstruoBox.Location.Y); } if ((e.KeyData == Keys.W) && (MonstruoBox.Location.Y >= 30)) { MonstruoBox.Location = new Point(MonstruoBox.Location.X, MonstruoBox.Location.Y - 20); } if ((e.KeyData == Keys.S) && (MonstruoBox.Location.Y <= 500)) { MonstruoBox.Location = new Point(MonstruoBox.Location.X, MonstruoBox.Location.Y + 20); } ///////////////////////////////////////// ////MOVIMIENTO DEL MonstruoButton//////// //////////////////////////////////////// if ((e.KeyData == Keys.A) && (MonstruoButton.Location.X >= 0)) { MonstruoButton.Location = new Point(MonstruoButton.Location.X - 20, MonstruoButton.Location.Y); } if ((e.KeyData == Keys.D) && (MonstruoButton.Location.X <= 800)) { MonstruoButton.Location = new Point(MonstruoButton.Location.X + 20, MonstruoButton.Location.Y); } if ((e.KeyData == Keys.W) && (MonstruoButton.Location.Y >= 30)) { MonstruoButton.Location = new Point(MonstruoButton.Location.X, MonstruoButton.Location.Y - 20); } if ((e.KeyData == Keys.S) && (MonstruoButton.Location.Y <= 500)) { MonstruoButton.Location = new Point(MonstruoButton.Location.X, MonstruoButton.Location.Y + 20); } /////////////////////////////////// /////MOVIMIENTO DE LA CRIATURA///// /////////////////////////////////// if (CriaturaBox.Bounds.IntersectsWith(MonstruoButton.Bounds)) { Move_Criatura(); lv1 = lv1 + 5; Comida.Text = "Ciraturas Comidas : " + lv1; BarLv1.Increment(20); } if (lv1 == 5) { MessageBox.Show("Nivel 1 Completado"); MessageBox.Show("Dificultad Aumentada", " Nivel 2"); Victory1 frm = new Victory1(); frm.Show(); Contadores.Stop(); this.Close(); } /////////////////////////////////// /////AVISOS EN LA PANTALLA///////// /////////////////////////////////// if (e.KeyData == Keys.Space) { CriaturaBox.Visible = true; Contadores.Start(); MensajeInicio.Visible = false; } }
public Form1() { InitializeComponent(); Contadores.Stop(); }