Exemple #1
0
 public void moveCpuRacquet() {
   if (racquetPositionX > game.ball.ballCoordinatesX && racquetPositionX >= 0) {
     racquetPositionX -= cpuRacquetSpeed;
   } else if (racquetPositionX < game.ball.ballCoordinatesX
       && racquetPositionX + RACQUETS_WIDTH <= game.getWidth()) {
     racquetPositionX += cpuRacquetSpeed;
   }
 }
Exemple #2
0
  public MapDisplay(
      String level, String picpath, String shadowpath, int col, int row, GamePanel p) {
    tiles = new Vector<Tile>();

    parent = (Game) p;

    loadLevelData(level);

    control = ImageControl.getInstance();
    control.setSourceImage(picpath, col, row);
    control.setShadowImage(shadowpath, col, row);
    display = new Rectangle2D.Double(0, 0, parent.getWidth(), parent.getHeight());
  }
Exemple #3
0
 /** The method controls the racquet and does not allow her to leave the frame edges. */
 public void move() {
   if (racquetPositionX + racquetDirectionX > 0
       && racquetPositionX + racquetDirectionX < game.getWidth() - RACQUETS_WIDTH)
     racquetPositionX = racquetPositionX + racquetDirectionX;
 }