/// <summary> /// Constructor /// </summary> public arkanoid() { InitializeComponent(); wld = new Bitmap(20 * _mult, 20 * _mult); g = Graphics.FromImage(wld); b = new bola(6 * Math.PI / 8); padd = new Base(); padd.tamano = 80; padd.Y = 750; b.tamano = (int)(0.5 * _mult); b.X = 5 * _mult; b.Y = 5 * _mult; for (int i = 0; i < 10; i++) { for (int j = 0; j < 6; j++) { bloques[i, j] = new Bloque(); bloques[i, j].X = 5 + i * 80; bloques[i, j].Y = 20 + j * 40; bloques[i, j].color = Color.Blue; bloques[i, j].ouch += arkanoid_ouch; } } pictureBox1.Image = wld; refreshGame(); }
/// <summary> /// Validar las colisiones con la bola. /// </summary> /// <param name="b">Bola.</param> public void validarColision(bola b) { if (_activo) { if (((b.X + 20 >= X) & (b.X <= (X + 70))) && ((b.Y + 20 >= Y) & (b.Y <= (Y + 30)))) { _activo = false; if (ouch != null) { ouch(this, new BloqueEventArgs(1)); } } } }
/// <summary> /// Validar las colisiones con la bola. /// </summary> /// <param name="b">Bola.</param> public void validarColision(bola b) { if (_activo) { if (((b.X + 20 >= X) & (b.X <= (X + 70))) && ((b.Y + 20 >= Y) & (b.Y <= (Y + 30)))) { _activo = false; if (ouch != null) ouch(this, new BloqueEventArgs(1)); } } }