Skip to content
Snippets Groups Projects
Commit 68d145d4 authored by yangxvlin's avatar yangxvlin
Browse files

finish Q3d with println commented

parent e00eceb1
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,12 @@ public class Q3 extends AbstractGame {
// (x2; y2) is given by: d_12 = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2))
private static final double SCORE_DISTANCE = 20;
// (d) Instead of printing the greeting to the console, draw the text to the screen using the font provided
// (res/conformable.otf). Draw it in size 24 font at coordinate (32, 32). (See the Font class in Bagel
// documentation.)
private final Font font = new Font("res/conformable.otf", 24);
private static final Point FONT_POSITION = new Point(32, 32);
public static void main(String[] args) {
new Q3().run();
}
......@@ -57,7 +63,8 @@ public class Q3 extends AbstractGame {
// (d)
if (new Point(playerX, playerY).distanceTo(BALL_POSITION) <= SCORE_DISTANCE) {
System.out.println("Great job!");
// System.out.println("Great job!");
font.drawString("Great job!", FONT_POSITION.x, FONT_POSITION.y);
}
playerImage.draw(playerX, playerY);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment