-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGamePlay.java
More file actions
52 lines (38 loc) · 1.32 KB
/
GamePlay.java
File metadata and controls
52 lines (38 loc) · 1.32 KB
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
import javafx.stage.*;
import javafx.scene.*;
import javafx.scene.layout.*;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.geometry.*;
public class GamePlay {
public static void display(String title, String message) {
Stage MainPage = new Stage();
MainPage.initModality(Modality.APPLICATION_MODAL);
MainPage.setTitle("Game Title");
Label score = new Label();
score.setText(message);
/**
* Adds image for background.
*/
ImageView gamePic = new ImageView();
Image bckGrd = new Image(WAM.class.getResourceAsStream("Background2.png"));
gamePic.setImage(bckGrd);
Button pause = new Button("Pause");
pause.setOnAction(e -> PauseWindow.display("Pause"));
HBox gameWin = new HBox(25);
gameWin.getChildren().addAll(score, pause);
gameWin.setAlignment(Pos.TOP_RIGHT);
StackPane game = new StackPane();
game.getChildren().addAll(gameWin, gamePic);
Scene gameBoard = new Scene(game);
MainPage.setScene(gameBoard);
MainPage.showAndWait();
/**
* The following will be where main play action takes place. Also, need
* to add in background png file. This will set mole holes in random
* spaces, separate out the "play field" into 9 spaces to be filled
* randomely. 5 for first level, and add x holes at each new level.
*/
}
}