Пример #1
0
        public bool VerificarColisionMonsBal(Bala b)
        {
            bool respuesta = false;

            for (int i = 0; i < monstruos.Length; i++)
            {
                if (monstruos[i].GetRectangle().IntersectsWith(b.GetRectangle()))
                {
                    respuesta = true;
                    monstruos[i].Desaparecer();
                }
            }
            return(respuesta);
        }
Пример #2
0
        public Juego()     //Constructor del juego
        {
            InitializeComponent();
            p  = new Jugador(pbCancha.Width, pbCancha.Height);
            m  = new Monstruos(5, pbCancha.Width, pbCancha.Height);
            pl = new Plataformas(90, pbCancha.Width, pbCancha.Height);

            b = new Bala(pbCancha.Width, pbCancha.Height, p);
            pbCancha.BackgroundImage = Image.FromFile("..\\..\\img\\volcan.png");
            SoundPlayer player = new SoundPlayer("..\\..\\sound\\sonido.wav");

            if (colision == false || p.estado == false)         //Si el jugador se cae o colisiona deja de sonar la musica
            {
                player.Stop();
            }
            else
            {
                player.Play();
            }
        }