예제 #1
0
파일: AIBat.cs 프로젝트: rohit12/Pong
 public override void UpdatePosition(Ball ball)
 {
     if (ball.GetDirection() > 1.5 * Math.PI || ball.GetDirection() < 0.5 * Math.PI)
      {
          if (ball.GetPosition().Y - 5 > GetPosition().Y + GetSize().Height / 2)
          {
              MoveDown();
          }
          else if (ball.GetPosition().Y == GetPosition().Y + GetSize().Height / 2)
          {
          }
          else if (ball.GetPosition().Y + 5 < GetPosition().Y + GetSize().Height / 2)
          {
              MoveUp();
          }
      }
      base.UpdatePosition(ball);
 }
예제 #2
0
파일: Game1.cs 프로젝트: rohit12/Pong
 protected override void Initialize()
 {
     screenHeight = 600;
     screenWidth = 800;
     menu = new Menu();
     gamestate = GameStates.Menu;
     resetTimer = 0;
     resetTimerInUse = true;
     lastScored = false;
     graphics.PreferredBackBufferWidth = screenWidth;
     graphics.PreferredBackBufferHeight = screenHeight;
     graphics.IsFullScreen = false;
     graphics.ApplyChanges();
     ball = new Ball(Content, new Vector2(screenWidth, screenHeight));
     SetUpMulti();
     input = new Input();
     base.Initialize();
 }