Ejemplo n.º 1
0
        public void Update(GameTime gameTime)
        {
            if (parent.Spawning)
            {
                if (parent.Position.Y <= stoppingPosition)
                {
                    parent.Spawning           = false;
                    parent.FinishedSpawning   = true;
                    parent.CollisionRectangle = CollisionRectangle;
                    parent.Velocity           = new Vector2(parent.MaxVelocity.X, 0.0f);
                }

                parent.Position = new Vector2(parent.Position.X, parent.Position.Y + parent.Velocity.Y);
            }

            if (parent.FinishedSpawning)
            {
                Physics.Move(parent);
            }

            if (gameTime.TotalGameTime.Milliseconds % GameValues.Mushroom1UPUpdateDelay == 0)
            {
                sprite.AdvanceFrame();
            }
            sprite.UpdateSpritePosition(parent.Position);
        }
Ejemplo n.º 2
0
        public void Update(GameTime gameTime)
        {
            if (parent.Spawning)
            {
                parent.Velocity = new Vector2(parent.Velocity.X, parent.Velocity.Y + 1);

                /*
                 * if (parent.Position.Y + parent.Velocity.Y >= stoppingPosition)
                 * {
                 *  parent.Spawning = false;
                 * }
                 */
                parent.Position = new Vector2(parent.Position.X, parent.Position.Y + parent.Velocity.Y);
            }

            if (parent.FinishedSpawning)
            {
                Physics.Move(parent);
            }

            if (gameTime.TotalGameTime.Milliseconds % GameValues.RotatingCoinUpdateDelay == 0)
            {
                sprite.AdvanceFrame();
            }
            sprite.UpdateSpritePosition(parent.Position);
        }
Ejemplo n.º 3
0
        public void Update(GameTime gameTime)
        {
            if (parent.Spawning)
            {
                if (parent.Position.Y <= stoppingPosition)
                {
                    parent.Spawning           = false;
                    parent.FinishedSpawning   = true;
                    parent.CollisionRectangle = CollisionRectangle;
                    parent.Velocity           = new Vector2(parent.MaxVelocity.X, 0f);
                }

                parent.Position = new Vector2(parent.Position.X, parent.Position.Y + parent.Velocity.Y);
            }

            if (parent.FinishedSpawning)
            {
                if (!parent.InAir) // this needs to be done when star collides with ground, and that will make the InAir boolean in Item useless
                {
                    parent.InAir    = true;
                    parent.Velocity = new Vector2(parent.Velocity.X, -GameValues.PhysicsMaxYVelocity);
                }

                Physics.Move(parent);
            }

            if (gameTime.TotalGameTime.Milliseconds % GameValues.StarUpdateDelay == 0)
            {
                sprite.AdvanceFrame();
            }
            sprite.UpdateSpritePosition(parent.Position);
        }
 public void Update(GameTime gameTime)
 {
     if (gameTime.TotalGameTime.Milliseconds % GameValues.YoshiIdleUpdateDelay == 0)
     {
         sprite.AdvanceFrame();
     }
     sprite.UpdateSpritePosition(parent.Position);
 }
 public void Update(GameTime gameTime, Vector2 position)
 {
     if (gameTime.TotalGameTime.Milliseconds % GameValues.KoopaUpdateDelay == 0)
     {
         sprite.AdvanceFrame();
         sprite.UpdateSpritePosition(position);
     }
 }
Ejemplo n.º 6
0
        public void Update(GameTime gameTime)
        {
            sprite.UpdateSpritePosition(playableObject.Position);

            if (gameTime.TotalGameTime.Milliseconds % GameValues.MarioStateFlagSlideUpdateDelay == 0)
            {
                sprite.AdvanceFrame();
            }
        }
Ejemplo n.º 7
0
 public void Update(GameTime gameTime, Vector2 position)
 {
     if (gameTime.TotalGameTime.Milliseconds % GameValues.QuestionBlockUpdateDelay == 0)
     {
         sprite.AdvanceFrame();
     }
     sprite.UpdateSpritePosition(position);
     CollisionRectangle = sprite.SpriteDestinationRectangle;
 }
Ejemplo n.º 8
0
        public void Update(GameTime gameTime)
        {
            parent.CollisionRectangle = CollisionRectangle;

            if (gameTime.TotalGameTime.Milliseconds % GameValues.FloatCoinUpdateDelay == 0)
            {
                sprite.AdvanceFrame();
            }
            sprite.UpdateSpritePosition(parent.Position);
        }
        public void Update(GameTime gameTime)
        {
            if (yoshiSpawnBuffer > 60)
            {
                yoshiSpawnBuffer             = 0;
                parent.Position              = new Vector2(parent.Position.X, parent.Position.Y - 16);
                parent.ItemState             = new YoshiIdle(parent);
                parent.CollisionRectangle    = parent.CollisionRectangle;
                parent.FinishedYoshiSpawning = true;
            }
            yoshiSpawnBuffer++;

            if (gameTime.TotalGameTime.Milliseconds % GameValues.YoshiSpawningUpdateDelay == 0)
            {
                sprite.AdvanceFrame();
            }
            sprite.UpdateSpritePosition(parent.Position);
        }
        public void Update(GameTime gameTime)
        {
            if (gameTime.TotalGameTime.Milliseconds % GameValues.MarioStateWalkingUpdateDelay == 0)
            {
                sprite.AdvanceFrame();
            }
            sprite.UpdateSpritePosition(playableObject.Position);

            if (playableObject.Velocity.X == 0)
            {
                playableObject.Acceleration        = Vector2.Zero;
                playableObject.PlayableObjectState = new FireRightIdleMario(playableObject);
            }
            else if (playableObject.Velocity.X < 0)
            {
                playableObject.Acceleration        = Vector2.Zero;
                playableObject.PlayableObjectState = new FireLeftWalkingMario(playableObject);
            }
        }
Ejemplo n.º 11
0
 public void Update(GameTime gameTime)
 {
     if (sprite.CurrentFrame < GameValues.MarioStateSmallToBigMaxSpriteFrames)
     {
         if (growthBuffer <= 0)
         {
             growthBuffer = GameValues.MarioStateSmallToBigGrowthBuffer;
             sprite.AdvanceFrame();
         }
         else
         {
             growthBuffer--;
         }
     }
     else
     {
         playableObject.PlayableObjectState  = new BigLeftIdleMario(playableObject);
         GameStateMachine.Instance.GameState = new PlayingState();
     }
 }
 public void Update(GameTime gameTime, Vector2 position)
 {
     if (gameTime.TotalGameTime.Milliseconds % GameValues.PiranhaPlantUpdateDelay == 0)
     {
         if (updatePosition.Y < (startingPosition.Y + sprite.Texture.Height) && raisePlant == true)
         {
             updatePosition.Y += 1;
         }
         else if (updatePosition.Y == (startingPosition.Y + sprite.Texture.Height) && pauseTime < GameValues.PiranhaPlantMaxRaisedTime)
         {
             pauseTime++;
             if (raisePlant == true)
             {
                 raisePlant = false;
             }
         }
         else if (updatePosition.Y > startingPosition.Y && raisePlant == false)
         {
             pauseTime         = 0;
             updatePosition.Y -= 1;
         }
         else if (updatePosition.Y == startingPosition.Y && pauseTime < GameValues.PiranhaPlantMaxLoweredTime)
         {
             pauseTime++;
         }
         else if (updatePosition.Y == startingPosition.Y && raisePlant == false)
         {
             pauseTime  = 0;
             raisePlant = true;
         }
         sprite.AdvanceFrame();
         sprite.UpdateSpritePosition(updatePosition);
     }
     parent.CollisionRectangle = CollisionRectangle;
     parent.Acceleration       = Vector2.Zero;
     parent.Velocity           = Vector2.Zero;
     parent.MaxVelocity        = Vector2.Zero;
     parent.Position           = updatePosition;
 }
Ejemplo n.º 13
0
        public void Update(GameTime gameTime, Vector2 position)
        {
            if (gameTime.TotalGameTime.Milliseconds % GameValues.BowserChangeStateDelay == 0)
            {
                if (!IsOpenMouth)
                {
                    IsOpenMouth = true;
                    sprite      = AnimatedSpriteFactory.Instance.BuildBowserLeftWalkingOpenSprite(new Vector2(position.X, position.Y));
                    ShootFireball();
                }
                else
                {
                    IsOpenMouth = false;
                    sprite      = AnimatedSpriteFactory.Instance.BuildBowserLeftWalkingClosedSprite(new Vector2(position.X, position.Y));
                }
            }

            else if (gameTime.TotalGameTime.Milliseconds % GameValues.BowserUpdateDelay == 0)
            {
                sprite.AdvanceFrame();
                sprite.UpdateSpritePosition(position);
            }
        }
 public void Update(GameTime gameTime, Vector2 position)
 {
     sprite.AdvanceFrame();
     sprite.UpdateSpritePosition(position);
 }