-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLose.java
57 lines (45 loc) · 1.36 KB
/
Lose.java
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
//Reference:
//https://github.com/daniel-chai/javafx-game/tree/master/src
//https://github.com/AlmasB/FXTutorials/tree/master/src/com/almasb
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
// i mean lose not lost (lol)
public class Lost extends FightObject implements IScene{
private SceneControl scene;
private Scene lostScene;
private Group root;
////Constructor for the lost
public Lost (SceneControl scene) {
this.scene = scene;
}
@Override
public Scene init(int width, int height) {
// TODO Auto-generated method stub
root = new Group();
lostScene = new Scene(root, width, height, Color.LAVENDER);
addLostText();
addStartButton();
return lostScene;
}
//add lose text message
public void addLostText() {
Text lostText = Object.createT("Game Over !! " , 60, 60);
root.getChildren().add(lostText);
}
//add start button
public void addStartButton() {
Button startButton = Object.CreateB("Again", 300, 300);
startButton.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event) {
scene.MenuScene (scene);
}
});
root.getChildren().add(startButton);
}
}