Example #1
0
        public void Update(GameTime gameTime)
        {
            CurrentProjectile.Update(gameTime);
            Timer--;
            if (Direction == Direction.Right)
            {
                if (hitSlowdown > 0)
                {
                    X += XSpeed / 5;
                }
                else
                {
                    X += XSpeed;
                }
            }
            else
            {
                X -= XSpeed;
            }
            Y     += YSpeed;
            Hitbox = new Rectangle();
            Hitbox info = CurrentProjectile.CurrentHitboxInfo;

            if (info != null)
            {
                Hitbox = info.getHitboxRectangle(Hitbox, Direction.Right, v2Position, CurrentProjectile.FrameWidth);
            }

            if (hitSlowdown > 0)
            {
                hitSlowdown--;
            }
            if (PlayOnce)
            {
                Finished = CurrentProjectile.IsDone;
            }
            else
            {
                if (Timer <= 0)
                {
                    Finished = true;
                }
                if (CurrentProjectile.PlayCount > 0)
                {
                    // If there is, see if the currently playing animation has
                    // completed a full animation loop
                    //
                    if (!String.IsNullOrEmpty(CurrentProjectile.NextAnimation))
                    {
                        // If it has, set up the next animation
                        CurrentAnimation = CurrentProjectile.NextAnimation;
                    }
                }
            }
        }
Example #2
0
        public void Update(float DeltaTime)
        {
            CurrentKeyboard = Keyboard.GetState();

            PlayerManager.Update(DeltaTime);

            foreach (var CurrentWorm in Worms)
            {
                CurrentWorm.Update(DeltaTime);
            }

            foreach (var CurrentProjectile in Projectiles)
            {
                CurrentProjectile.Update(DeltaTime);
            }
            foreach (var ProjectileToRemove in ProjectilesToRemove)
            {
                Projectiles.Remove(ProjectileToRemove);
            }
            ProjectilesToRemove.Clear();
        }