Example #1
0
        private void HandleSBomb(GamePadState gState, GameTime time)
        {
            sBombTimer -= (float)time.ElapsedGameTime.Milliseconds / 1000.0f;

            if (sBombTimer < 0)
            {
                sBombTimer = 0;
            }

            if (gState.Buttons.LeftShoulder == ButtonState.Pressed && !lbDown && sBombTimer == 0)
            {
                lbDown = true;
                if (points >= SBOMB_COST)
                {
                    sBombTimer = MIN_SBOMB_TIMER;

                    if (LevelManager.Mode != GameMode.Worms)
                    {
                        blasts.Add(NormalMap.AddBlast(Position, 5, 1));
                        points -= SBOMB_COST;
                    }
                    else
                    {
                        float   angle;
                        Vector2 v = new Vector2();

                        for (int i = 0; i < 6; i++)
                        {
                            angle = MathHelper.TwoPi * ((float)(i + 1) / 6.0f);
                            v.X   = (float)Math.Cos(angle) * Player.BULLET_SPEED;
                            v.Y   = (float)Math.Sin(angle) * Player.BULLET_SPEED;
                            SBBrancher b = new SBBrancher(position, bTex4, 2, angle, 0, 20);

                            bullets.Add(b);
                        }

                        points = 0;
                    }
                }
            }
            else if (gState.Buttons.LeftShoulder == ButtonState.Released)
            {
                lbDown = false;
            }
        }
Example #2
0
        //Checks for and removes Dead bullets
        public static void DeleteBullets(List <Bullet> bs, bool large)
        {
            float scale;

            if (large)
            {
                scale = 0.7f;
            }
            else
            {
                scale = 0.5f;
            }

            for (int i = 0; i < bs.Count; i++)
            {
                if (bs[i].IsDead)
                {
                    NormalMap.AddBlast(bs[i].Position, scale, scale);

                    bs.RemoveAt(i);
                }
            }
        }