public void findeljuego() { puntaje = 0; puntos.Text = "0"; ejex = true; ejey = true; xdir = 0; ydir = 0; cabeza = new Cola(10, 10); comida = new Comida(); MessageBox.Show("GAME OVER"); }
public void Findejuego() { puntaje = 0; Puntos.Text = "0"; ejex = true; ejey = true; xdir = 0; ydir = 0; bucle.Interval = 100; cabeza = new cola(10, 10); comida = new Comida(); MessageBox.Show("Perdiste"); }
public VentanaDelJuego() { InitializeComponent(); // Aqui hacemos el juego _mapa = new Mapa(this.Width, this.Height); Console.WriteLine("Width: " + _mapa.Width + ", Height: " + _mapa.Height); Point p = new Point(0, 0); _snake = new Snake(_mapa.Width / 2, _mapa.Height / 2); _comida = new Comida(200, 200); }
public void FinalizarJuego() { IntPuntuacion = 0; TxtPuntos.Text = "0"; EjeX = true; EjeY = true; DireccionX = 0; DireccionY = 0; Cabeza = new Cuerpo(10, 10); comida = new Comida(); PbrPuntosLogro.Maximum = 10; PbrPuntosLogro.Minimum = 0; PbrPuntosLogro.Value = 0; LblLogrosAlcanzados.Text = "0"; LblProximoLogro.Text = "10 puntos"; SoundPlayer simpleSound = new SoundPlayer(Directory.GetParent(Environment.CurrentDirectory).Parent.FullName + @"\Multimedia\Sonidos\GameOver.wav"); simpleSound.Play(); MessageBox.Show("Game Over!"); }
private void move() { if (bit.x == x && bit.y == y) { bit = null; while (bit == null) { int newx = rand.Next(0, 60); int newy = rand.Next(0, 45); if (check_collision(newx, newy, objetos) == false) { bit = new Comida(newx, newy, Color.Yellow); } } score++; } else { objetos[0][0].desdibuja(papel, background); objetos[0].RemoveAt(0); } }
private void bucle_Tick(object sender, EventArgs e) // efecto de animacion { g.Clear(Color.White); //redibuja un espectro de movimiento serpiente.Dibujar(g); comida.Dibujar(g); Movimiento(); ChocarCuerpo(); ChocarParded(); FrutaChoca(); if (serpiente.Choque(comida)) //cuando la serpiente choque con la comida { comida = new Comida(); //se reescribira la posicion de la comida serpiente.Comer(); lblPuntuacion.Text = (++puntaje).ToString(); } if (puntaje <= 50) { if (puntaje == 10) { bucle.Interval = 90; } else if (puntaje == 20) { bucle.Interval = 80; } else if (puntaje == 30) { bucle.Interval = 70; } else if (puntaje == 40) { bucle.Interval = 60; } else if (puntaje == 50) { bucle.Interval = 50; } } }
private void button_Start_Click(object sender, EventArgs e) { papel.Clear(background); rand = new Random(rand.Next(0, 1024)); gameOver = false; pausa = false; godmode = checkBox1.Checked; speed = Convert.ToInt32(textBox1.Text); timer1.Interval = speed; score = 0; level = 1; x = 30; y = 22; diry = -1; dirx = 0; objetos = new List <List <Comida> >(); objetos.Add(new List <Comida>()); bit = new Comida(rand.Next(0, 60), rand.Next(0, 44), Color.Yellow); for (int i = 0; i < 4; i++) { objetos[0].Add(new Comida(x, y + i, rand)); } foreach (List <Comida> objeto in objetos) { foreach (Comida parte in objeto) { parte.dibujar(papel); } } button_start.Hide(); checkBox1.Hide(); button_Pausa.Show(); textBox1.Hide(); label2.Hide(); timer1.Start(); }
public void FrutaChoca() { Serpiente temp; try { temp = serpiente.Siguiente(); } catch (Exception e) { temp = null; } while (temp != null) { if (comida.Choque(temp)) { comida = new Comida(); } else { temp = temp.Siguiente(); } } }