public Nivel_4() { InitializeComponent(); PierdesLv4.Start(); Pierdes2Lv4.Start(); CentinelaAparicion.Start(); ///////////////////////////////////// ////ARREGLO DE OBSTACULOS//////////// ///////////////////////////////////// for (int j = 0, y = 60; j < Obstaculos.GetLength(1); j++, y += 80) { for (int i = 0, x = 35; i < Obstaculos.GetLength(0); i++, x += 150) { Obstaculos[i, j] = new PictureBox(); ((System.ComponentModel.ISupportInitialize)(Obstaculos[i, j])).BeginInit(); this.SuspendLayout(); imagen = nroAleatorio.Next(2); 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; } } 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); } } }
private void CentinelaAparicion_Tick(object sender, EventArgs e) { ///////////////////////////////////// //// APARICIONES DEL CENTINELA //////// ///////////////////////////////////// if (tiempo == 295) { Centinela.Location = new Point(Mov.Next(650), (Mov.Next(370))); } if (tiempo == 260) { Centinela.Location = new Point(Mov.Next(650), (Mov.Next(370))); } if (tiempo == 275) { Centinela.Location = new Point(926, 118); } if (tiempo == 250) { Centinela.Location = new Point(926, 118); } if (tiempo == 200) { Centinela.Location = new Point(Mov.Next(650), (Mov.Next(370))); } if (tiempo == 190) { Centinela.Location = new Point(926, 118); } if (tiempo == 100) { Centinela.Location = new Point(Mov.Next(650), (Mov.Next(370))); } if (tiempo == 80) { Centinela.Location = new Point(926, 118); } //////////////////////////////////////////// ////COLISION ENTRE CENTINELA Y MONSTRUO///// //////////////////////////////////////////// if (Poder.IntersectsWith(Monstruo)) { Pierdes2Lv4.Stop(); TiempoPoder.Start(); Duracion.Visible = true; Centinela.Location = new Point(926, 118); } if (tiempoCentinela == 0) { Pierdes2Lv4.Start(); TiempoPoder.Stop(); tiempoCentinela = 10; Duracion.Text = "Duracion Efecto : " + tiempoCentinela; Duracion.Visible = false; Centinela.Location = new Point(926, 118); } }