public void Execute()
 {
     if (Koopa.Health == KoopaStateMachine.KoopaHealth.Shelled && Koopa.Physics.IsMovingX())
     {
         Goomba.BeFlipped();
         Game.st.DefeatGoomba();
         ScoreAssignments sa = new ScoreAssignments();
         Game.UI.DisplayScore(sa.Goomba, Goomba.Location);
     }
     else
     {
         MoveEnemies();
         Koopa.ChangeDirection();
         Goomba.ChangeDirection();
     }
 }
 public void Execute()
 {
     if (goombaOne.Health == GoombaStateMachine.GoombaHealth.Normal &&
         goombaTwo.Health == GoombaStateMachine.GoombaHealth.Normal)
     {
         if (side is Left || side is Right)
         {
             MoveGoombas();
             goombaOne.ChangeDirection();
             goombaTwo.ChangeDirection();
         }
         else
         {
             StackGoombas();
         }
     }
 }
 public Vector2 ClampPosition(double xPos, double yPos)
 {
     if (xPos < MinPosition.X)
     {
         Goomba.ChangeDirection();
         xPos = MinPosition.X;
     }
     if (yPos > MinPosition.Y)
     {
         yPos = MinPosition.Y;
     }
     else if (yPos < MaxPosition.Y)
     {
         yPos      = MaxPosition.Y;
         YVelocity = 0;
     }
     return(new Vector2((float)xPos, (float)yPos));
 }
Beispiel #4
0
 private void MoveGoomba()
 {
     if (collision.Width > collision.Height)
     {
         goomba.SetPosition(new Vector2(goomba.DestinationRectangle.X,
                                        goomba.DestinationRectangle.Y - collision.Height));
     }
     else if (collision.Height > collision.Width)
     {
         if (side.BottomOrRight is Goomba)
         {
             goomba.SetPosition(new Vector2(goomba.DestinationRectangle.X +
                                            collision.Width, goomba.DestinationRectangle.Y));
         }
         else
         {
             goomba.SetPosition(new Vector2(goomba.DestinationRectangle.X -
                                            collision.Width, goomba.DestinationRectangle.Y));
         }
         goomba.ChangeDirection();
     }
 }