Пример #1
0
 public override void Update()
 {
     if (Bowser.SpriteVelocity.Y > 0)//bowser is moving down
     {
         CurrentState.ExitState();
         CurrentState = new FallingBowserState(Bowser);
         CurrentState.Enter();
     }
     else if (Bowser.Mario.BoundBox.X > Bowser.SpritePosition.X && Bowser.SpriteVelocity.X <= 0)//mario is on the right
     {
         Bowser.SpriteVelocity = new Vector2(2, 2);
     }
     else if (Bowser.Mario.BoundBox.X < Bowser.SpritePosition.X && Bowser.SpriteVelocity.X >= 0)//mario on left
     {
         Bowser.SpriteVelocity = new Vector2(-2, 2);
     }
     if (Bowser.Mario.SpritePosition.Y < Bowser.SpritePosition.Y)//mario jumped so bowser will jump too
     {
         CurrentState.ExitState();
         CurrentState = new JumpingBowserState(Bowser);
         CurrentState.Enter();
     }
     else
     {
         Bowser.SpriteVelocity = new Vector2(Bowser.SpriteVelocity.X, 1);
     }
 }
Пример #2
0
 public void Falling()
 {
     CurrentState.ExitState();
     CurrentState = new FallingBowserState(Bowser);
     CurrentState.Enter();
 }