Exemple #1
0
 void cargando()
 {
     btnNuevo.Visible  = true;
     btnSalir.Visible  = true;
     nuevo_txt.Visible = true;
     Fin_text.Visible  = false;
     TimerMover.Stop();
     coche1_mover.Stop();
     coche2_mover.Stop();
     coche3_mover.Stop();
 }
Exemple #2
0
        private void TimerMover_Tick(object sender, EventArgs e)
        {
            Velocidad_text.Text = "Velocidad: " + velocidad;

            if (score > 10 & score < 20)
            {
                velocidad          = 4;
                nivel_text.Text    = "Nivel: 2";
                nivel2_txt.Visible = true;
                this.BackColor     = Color.DimGray;
            }
            if (score > 20 & score < 30)
            {
                velocidad          = 5;
                nivel_text.Text    = "Nivel: 3";
                nivel3_txt.Visible = true;
                nivel2_txt.Visible = false;
                this.BackColor     = Color.Sienna;
            }
            if (score > 30)
            {
                velocidad        = 6;
                nivel_text.Text  = "Nivel: 4";
                gana_txt.Visible = true;
                GANASTE();
            }

            if (Carro.Bounds.IntersectsWith(coche1.Bounds))
            {
                gameOver();
            }
            if (Carro.Bounds.IntersectsWith(coche2.Bounds))
            {
                gameOver();
            }
            if (Carro.Bounds.IntersectsWith(coche3.Bounds))
            {
                gameOver();
            }
            if (Carro.Bounds.IntersectsWith(nivel_gasolina.Bounds))
            {
                nivel_gasolina.Location = new Point(aleatorio.Next(350), aleatorio.Next(500));
                tiempo += 50;
            }


            void gameOver()
            {
                if (tiempo < 0) //PIERDE POR NO TENER NITRO
                {
                    btnNuevo.Visible = true;
                    btnSalir.Visible = true;
                    Fin_text.Visible = true;
                    TimerMover.Stop();
                    coche1_mover.Stop();
                    coche2_mover.Stop();
                    coche3_mover.Stop();
                }
                btnNuevo.Visible = true;
                btnSalir.Visible = true;
                Fin_text.Visible = true;
                TimerMover.Stop();
                coche1_mover.Stop();
                coche2_mover.Stop();
                coche3_mover.Stop();
                audiostop();
                audiochoque();
            }

            void GANASTE()
            {
                btnNuevo.Visible = true;
                btnSalir.Visible = true;
                TimerMover.Stop();
                coche1_mover.Stop();
                coche2_mover.Stop();
                coche3_mover.Stop();
                audioganaste();
            }
        }