Example #1
0
        public void Reiniciar()
        {
            timer1.Enabled = false;
            MessageBox.Show("Perdiste. \nTu Puntuacion es " + puntuacion);

            BarraPuntuacionSerpiente.Text = "0";
            puntuacion = 0;
            BarraPresionarEnter.Text = "Presiona Enter para iniciar";
            serpiente = new Serpiente();
        }
Example #2
0
 public void Ganar()
 {
     if (puntuacion == 100)
     {
         timer1.Enabled = false;
         MessageBox.Show("Ganaste el juego\n Tu puntuacion es: " + puntuacion);
         BarraPuntuacionSerpiente.Text = "0";
         puntuacion = 0;
         BarraPresionarEnter.Text = "Presiona Enter para iniciar";
         serpiente = new Serpiente();
     }
 }
Example #3
0
 private void Reiniciar()
 {
     //Mandamos a llamar el sonido
     System.Media.SoundPlayer SonidoComida = new System.Media.SoundPlayer(Properties.Resources.Perder);
     SonidoComida.Load();
     SonidoComida.Play();
     //Cuando tocas haces colision, el timer pasa a false y mostramos el msj
     timer1.Enabled = false;
     MessageBox.Show("Perdiste. \nTu Puntuacion es " + puntuacion);
     //Agregamos la puntuacion
     /*Puntuacion.Add(puntuacion);*/
     player.Puntos = puntuacion;
     //Volvemos a cero las puntuaciones
     BarraPuntuacionSerpiente.Text = "0";
     puntuacion = 0;
     //Volvemos a cero los niveles
     BarraDeNivel.Text = "0";
     //Reiniciamos el timer de la velocidad
     timer1.Interval = 140;
     //Modificamos los botones, cuadros de texto y labels, para que se presentar como uno quiere
     BotonIniciar.Enabled = false;
     BotonInstrucciones.Enabled = true;
     BotonPuntuaciones.Enabled = true;
     clearBtn.Enabled = true;
     NombreTxt.Visible = true;
     BtnAgregar.Visible = true;
     LblIngresa.Visible = true;
     NombreTxt.Enabled = true;
     BtnAgregar.Enabled = true;
     //Iniciamos el nuevo juego
     serpiente = new Serpiente();
 }
Example #4
0
 private void Ganar()
 {
     if (puntuacion >= 160)
     {
         System.Media.SoundPlayer SonidoComida = new System.Media.SoundPlayer(Properties.Resources.Ganar);
         SonidoComida.Load();
         SonidoComida.Play();
         //Si se cumple la condicion automaticamente el timer se vuelve false, y mostramos el msj y el reinicio
         timer1.Enabled = false;
         MessageBox.Show("Ganaste el juego\n Tu puntuacion es: " + puntuacion);
         //Agregamos la puntuacion
         /*Puntuacion.Add(puntuacion);*/
         player.Puntos = puntuacion;
         //Volvemos a cero las puntuaciones
         BarraPuntuacionSerpiente.Text = "0";
         puntuacion = 0;
         //Volvemos a cero los niveles
         BarraDeNivel.Text = "0";
         //Reiniciamos el timer de la velocidad
         timer1.Interval = 140;
         //Volvemos verdaderos todos los botones
         BotonIniciar.Enabled = false;
         BotonInstrucciones.Enabled = true;
         BotonPuntuaciones.Enabled = true;
         clearBtn.Enabled = true;
         NombreTxt.Visible = true;
         BtnAgregar.Visible = true;
         LblIngresa.Visible = true;
         NombreTxt.Enabled = true;
         BtnAgregar.Enabled = true;
         //Iniciamos el nuevo juego
         serpiente = new Serpiente();
     }
 }