示例#1
0
        public override void Update(GameTime gameTime)
        {
            //Updating the item's bounce
            base.Update(gameTime);
            if (Math.Abs(Position.Y - FixedPosition.Y) >= 40)
            {
                OutOfBlock = true;
                MoveAway();
                CanGravity = true;

                //Add the item as a collidable
                ItemOutsideBlock++;
                if (ItemOutsideBlock == 1)
                {
                    CollisionGrid.AddCollidable(this);
                }
            }
            if (OutOfBlock)
            {
                if (Math.Abs(Position.Y - FixedPosition.Y) >= 40)
                {
                    CanGravity = true;
                }
            }
            ////This is making Star jump Up and down
            //if (Math.Abs(Position.Y - FixedPosition.Y) >= 50)
            //{
            //    MoveAwayFactor = new Vector2(MoveAwayFactor.X, MoveAwayFactor.Y * -1);
            //}
            //MoveAway();
        }
示例#2
0
 public void AddItemsButCoinAsCollidable()
 {
     if (!ItemType.Equals("coin"))
     {
         CollisionGrid.AddCollidable(ItemModel);
     }
 }
 public override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     EnemyModel.Update(gameTime);
     //ItemMovement
     if (HasStartedMoving == 1)
     {
         //Only move left ONCE.
         HasStartedMoving++;
         if (NumOfEnemies > 0)
         {
             //Add the item to the collision grid and move the item
             EnemyModel = EnemyModelFactory.GetEnemyModel(EnemyType, Position, Velocity);
             //EnemyModel.Move(Position, false);
             EnemyModel.IsVisible = true;
             CollisionGrid.AddCollidable(EnemyModel);
             //If items still exist inside brick, bump the brick.
             CurrentState.ExplodedTransition();
             NumOfEnemies--;
         }
     }
 }
示例#4
0
 public override void Update(GameTime gameTime)
 {
     //Updating the item's bounce
     base.Update(gameTime);
     if (Math.Abs(Position.Y - FixedPosition.Y) >= 24)
     {
         Velocity = new Vector2(0, 0);
         //Add the item as a collidable
         ItemOutsideBlock++;
         if (ItemOutsideBlock == 1)
         {
             CollisionGrid.AddCollidable(this);
         }
     }
 }
 public override void Update(GameTime gameTime)
 {
     //Updating the item's bounce
     base.Update(gameTime);
     if (Math.Abs(Position.Y - FixedPosition.Y) >= 24)
     {
         //Velocity = new Vector2(50, 0);
         //After fully appearing, move away
         MoveAway();
         //Add the item as a collidable
         ItemOutsideBlock++;
         if (ItemOutsideBlock == 1)
         {
             CollisionGrid.AddCollidable(this);
         }
     }
     if (CanGravity)
     {
         Gravity(Support);
     }
 }