Exemple #1
0
        public override void Hit(float damage)
        {
            if (!FirstInChain)
            {
                NormalBullet b = new NormalBullet(stats.Size / 2, 1, position, RandUnitVector2() * Player.BULLET_SPEED, NormalMap.blastWave2);
                NormalMap.AddGenericBlast((BlastWave)b);
            }
            else
            {
                float dx = position.X - Player.Position.X;
                float dy = position.X - Player.Position.Y;

                float a = (float)Math.Atan2(dy, dx);

                float adjustment = MathHelper.Pi - angle;

                a += adjustment;
                a  = WrapAngle(a);

                float diff = (angle + adjustment) - a;

                if (diff < 0)
                {
                    angle += ROTATE_SPEED;
                }
                else
                {
                    angle -= ROTATE_SPEED;
                }
            }
            base.Hit(damage);
        }
Exemple #2
0
        public static void ResetAll()
        {
            NormalMap.ResetAll();
            DestroySaveTex();
            ClearBG(Color.Black);

            Game1.bg = bg;
        }
Exemple #3
0
 /// <summary>
 /// Kills the player and starts the countdown to the end of the game
 /// </summary>
 public static void StartFinalTimer()
 {
     startFinalTimer = true;
     if (!ForceCounter.Victory)
     {
         IsDead = true;
         NormalMap.AddStarWave(Position, 3.4f, 8);
     }
 }
Exemple #4
0
        public ShaderWrapper(Game1 game)
        {
            gRef           = game;
            diss           = game.Content.Load <Effect>("HLSL/Dissolve");
            normals        = game.Content.Load <Effect>("HLSL/NormalDistortion");
            bg             = game.Content.Load <Texture2D>("bigblack");
            ParticleShader = game.Content.Load <Effect>("HLSL/Particles");

            nMap            = new NormalMap(game);
            target          = new RenderTarget2D(gRef.GraphicsDevice, Game1.ScreenX, Game1.ScreenY, 1, SurfaceFormat.Rgba64);
            target2         = new RenderTarget2D(gRef.GraphicsDevice, Game1.ScreenX, Game1.ScreenY, 1, SurfaceFormat.Rgba64);
            returnToSaveTex = false;
        }
 public override void Die()
 {
     Player.Points += pointValue;
     if (LevelManager.Current.UIStats.PowerShown)
     {
         if (pointValue != 0)
         {
             UIEffect e = new UIEffect(position, RandUnitVector2(), 0.1f, "+" + pointValue.ToString(), Color.Turquoise, 0.9f);
             UILayer.AddUIEffect(e);
         }
     }
     NormalMap.AddBlast2(position, Size / 20, Size / 8);
 }
        public override void Die()
        {
            Vector2 nV;

            for (int i = 0; i < DEATH_GROWTH; i++)
            {
                nV = RandUnitVector2();
                Player.AddGrower(position, nV * Player.BulletSpeed, (float)Game1.rand.NextDouble() * 0.5f + 1f);
            }

            LevelManager.NextLevel(true);
            NormalMap.AddBlast2(position, 20, 5);
            base.Die();
        }
Exemple #7
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;
            }
        }
Exemple #8
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);
                }
            }
        }
        public virtual void Die()
        {
            Player.Points += pointValue;
            float pointsToAdd = (float)pointValue * Player.Multiplier;

            Player.Score += pointsToAdd;

            float txtScale = 0.9f;
            float grav     = 0.1f;

            if (pointsToAdd > 100)
            {
                txtScale = 1.5f;
                grav     = 0.04f;
            }
            if (LevelManager.Current.UIStats.PowerShown)
            {
                if (pointValue != 0)
                {
                    UIEffect e = new UIEffect(position, RandUnitVector2(), 0.1f, "+" + pointValue.ToString(), Color.Turquoise, 0.9f);
                    UILayer.AddUIEffect(e);
                }
            }
            if (pointValue != 0)
            {
                VertexBag v = new VertexBag(UIPositions.Score + UIPositions.ScoreOffset, Color.GreenYellow,
                                            Color.LawnGreen, 1, Math.Min((int)(50 * pointsToAdd), 1000), 10);
                UILayer.AddParticleEffect(v);
                UIEffect b = new UIEffect(position, RandUnitVector2(),
                                          grav, "+" + Math.Round(pointsToAdd, 1).ToString(),
                                          Color.Yellow, txtScale);

                UILayer.AddUIEffect(b);
            }
            NormalMap.AddBlast2(position, Size / 10, Size / 8);
        }