Exemple #1
0
        //destroy the ball at current location, make particle effect
        public void Kill()
        {
            //Make explision
            Random rand = new Random();
            for (int i = 0; i < 100; i++) {
                Particle p = new Particle(particleTexture,
                    (int)position.X,(int)position.Y,
                    new Vector2(rand.Next(-1000,1000)/100f,rand.Next(-1000,1000)/100f),
                    Color.Orange);
                p.life = - 200;
                particles.Add(p);
            }

            //set attributes
            isVisible = false;
            velocity = new Vector2(0, 0);
            position = new Vector2(Defualt.Default._W / 2, Defualt.Default._H / 2);
            boundingBox.X = (int)position.X; boundingBox.Y = (int)position.Y;
        }
Exemple #2
0
        //Paddle hit, make particle effect
        public void PaddleHit(Color newcolor)
        {
            //Figure out if it was right or left paddle
            int xMax, xMin;
            if (position.X > MainForm.ScreenWidth/ 2) { xMax = 0; xMin = -10; }
            else { xMax = 10; xMin = 0; }

            //make directional small explision
            Random rand = new Random();
            for (int i = 0; i < 8; i++) {
                Particle p = new Particle(particleTexture,
                    (int)position.X, (int)position.Y,
                    new Vector2(rand.Next(xMin,xMax) / 10f, rand.Next(-5, 5) / 10f),
                    newcolor,1);
                p.life = -100;
                particles.Add(p);
            }
        }