Exemple #1
0
  public void onMouseMove(Location point) {

    if (gameOn) {
      theFish.moveTo(point.getX() - theFish.getWidth() / 2, point.getY());

      lastMouse = point;
      currentScore = theFish.getScore();
      score.setText("Score: " + currentScore);
      score.moveTo((canvas.getWidth() - score.getWidth()) / 2, 50);
    }
  }
Exemple #2
0
  public void startGame() {

    bread.loop();
    gameOn = true;
    yellow.removeFromCanvas();
    pink.removeFromCanvas();
    purple.removeFromCanvas();
    green.removeFromCanvas();
    grey.removeFromCanvas();
    button.removeFromCanvas();
    author.removeFromCanvas();
    title.removeFromCanvas();

    start = new Location(canvas.getWidth() / 2, canvas.getHeight() / 2);
    theFish = new TheFish(fishPic, start, canvas, 50, 25);
    ocean = new Ocean(angryFishPic, angryFishL, bubblePic, canvas, theFish);

    score = new Text("Score: " + currentScore, 0, 0, canvas);
    score.setFontSize(16);
    score.moveTo((canvas.getWidth() - score.getWidth()) / 2, 50);

    bubbles = new Bubbles(dopeBubble, canvas);
  }
Exemple #3
0
 // Position the message to center it in the frame
 protected void positionContents() {
   message.moveTo(displayLeft(), displayTop());
   message.move(
       (displayWidth() - message.getWidth()) / 2, (displayHeight() - message.getHeight()) / 2);
 }