-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMazeIntro.java
More file actions
68 lines (63 loc) · 2.08 KB
/
MazeIntro.java
File metadata and controls
68 lines (63 loc) · 2.08 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import java.awt.*;
import javax.swing.*;
public class MazeIntro {
/**
* MazeIntro class of Slide Into Highschool, shows intro message for maze level
*
* <h2>Course Info:</h2>
* ICS4UP with Krasteva, V.
* Date: June 5st, 2023
* Time Spent: 0.5 hrs
* @version 1
* @author Charlie To, Milena Mofrad
*/
/** Holds the frame*/
JFrame frame;
public MazeIntro(JFrame frame, String text){
MainMenu.setIsMazeIntro(true);
this.frame = frame;
// Clear the frame
Container contentPane = frame.getContentPane();
contentPane.removeAll();
this.frame.revalidate();
this.frame.repaint();
}
/**
* Constructor method
*
* @param frame, text, text2, takes frames and texts to display
* @return name Function
*/
public MazeIntro(JFrame frame){
this.frame = frame;
// Clear the frame
Container contentPane = frame.getContentPane();
contentPane.removeAll();
this.frame.revalidate();
this.frame.repaint();
MainMenu.setIsMazeIntro(true);
}
public void run(){
frame.getContentPane().add(new Drawing());
frame.setVisible(true);
}
class Drawing extends JComponent {
public void paint(Graphics g) {
super.paintComponent(g);
// BACKGROUND
g.setColor(Colours.darkerBlue);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Colours.backgroundBlue);
g.fillRect(20, 20, getWidth()-40, getHeight()-40);
// NUMBERS
g.setColor(Color.WHITE);
g.setFont(Colours.title);
g.drawString("Welcome to the maze level", 100, 90);
g.setFont(new Font("Roboto", Font.PLAIN, 25));
g.drawString("Use 'W', 'A', 'S', 'D' to move yourself arround", 100, 170);
g.drawString("Complete the maze by overcoming obstacles you ", 100, 170+40+10);
g.drawString("see along the way", 100, 170+40+30+10);
g.drawString("Press any key to start, Good luck!", 100, 170+80+50);
}
}
}