Class GameEngine

java.lang.Object
org.comp2059.pong.controller.GameEngine

public class GameEngine extends Object
Owns one game's state and advances it independently of the UI timer.
  • Constructor Details

  • Method Details

    • addScoreListener

      public void addScoreListener(ScoreListener listener)
    • removeScoreListener

      public void removeScoreListener(ScoreListener listener)
    • reset

      public void reset(int width, int height)
      Resets the game to the current play area, ready for Start.
    • start

      public void start()
    • update

      public void update(long nowNanos)
      Advances one 10ms game tick; nowNanos must come from a monotonic clock.
    • getBall

      public Ball getBall()
    • getLeftPaddle

      public Paddle getLeftPaddle()
    • getRightPaddle

      public Paddle getRightPaddle()
    • getScoreLeft

      public int getScoreLeft()
    • getScoreRight

      public int getScoreRight()
    • isInitialized

      public boolean isInitialized()
    • isRunning

      public boolean isRunning()