Datasets:

ArXiv:
License:
File size: 2,281 Bytes
c574d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package rd222dv_assign3.Creature;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class CatchTheCreature extends Application {
	@Override
	public void start(Stage primaryStage) {

		Creature creature = new Creature();

		Scene scene = new Scene(creature.getRoot());
		primaryStage.setScene(scene);
		primaryStage.setTitle("Catch the Creature");
		primaryStage.setWidth(630);
		primaryStage.setHeight(600);
		primaryStage.show();
	}

	public static void main(String[] args) {
		Application.launch(args);
	}
}

	/*my old wrong "game"

	 public class IntValue {

	 

		public int value;



		public IntValue(int i) {

			value = i;

		}

	}

	@Override

	public void start(Stage primaryStage) {

		primaryStage.setTitle("Catch-The-Creature");



		Group root = new Group();

		Scene scene = new Scene(root);

		primaryStage.setScene(scene);



		Canvas canvas = new Canvas(500, 500);



		root.getChildren().add(canvas);



		Creature creature = new Creature(100, 100, 60);

		IntValue points = new IntValue(0);



		scene.setOnMouseClicked(new EventHandler<MouseEvent>() {

			public void handle(MouseEvent e) {

		//scene.setOnMouseEntered(e -> {

				if (creature.containsPoint(e.getX(), e.getY())) {

					double x = 50 + 400 * Math.random();

					double y = 50 + 400 * Math.random();

					creature.setCenter(x, y);

					points.value++;

				} else

					points.value = 0;

			}});



		GraphicsContext graphics = canvas.getGraphicsContext2D();



		Font theFont = Font.font("Sans Serif", FontWeight.BOLD, 24);

		graphics.setFont(theFont);

		graphics.setLineWidth(1);



		Image knight = new Image("file:src/Knight.png");



		new AnimationTimer() {

			public void handle(long currentNanoTime) {

				// Clear the canvas

				graphics.setFill(new Color(1.0, 1.0, 1.0, 1.0));

				graphics.fillRect(0, 0, 550, 550);



				graphics.drawImage(knight, creature.getX() - creature.getRadius(),

						creature.getY() - creature.getRadius());

				

				String text = "Points: " + points.value;

				graphics.fillText(text, 360, 42);

				graphics.strokeText(text, 360, 42);

				

			}

		}.start();



		primaryStage.show();

	}



	public static void main(String[] args) {

		launch(args);

	}

}*/