-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMeetThePerson.java
More file actions
126 lines (115 loc) · 3.99 KB
/
MeetThePerson.java
File metadata and controls
126 lines (115 loc) · 3.99 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import java.awt.*;
import javax.swing.*;
public class MeetThePerson {
/**
* MeetThePerson class of Slide Into Highschool, creates the meet the person game for the maze stage
*
* <h2>Course Info:</h2>
* ICS4UP with Krasteva, V.
* Date: June 7ht, 2023
* Time Spent: 2.5 hrs
* @version 1
* @author Charlie To, Milena Mofrad
*/
JFrame frame;
public static int x=0;
public static int y = 0;
public static int xPos = 0;
public static int yPos =0;
public static int score = 0;
public static int stage =1;
public static boolean hover1 = false;
public static boolean hover2 = false;
public static boolean isComplete = false;
/**
* Constructor method
*
* @param frame Takes JGrasp frame
*/
public MeetThePerson(JFrame frame) {
this.frame = frame;
// frame.addMouseListener(new ClickHandler());
// Clear the frame
Container contentPane = frame.getContentPane();
contentPane.removeAll();
this.frame.revalidate();
this.frame.repaint();
MainMenu.setIsMeetPerson(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);
// PERSON
g.setColor(new Color(200, 170, 150));
g.fillRect(180, 200, 40, 100);// neck
// face
g.fillOval(125, 125, 150, 150);
g.setColor(Color.BLACK);
g.fillOval(150, 160, 40, 40);
g.fillOval(210, 160, 40, 40);
g.fillRect(150, 220, 100, 20);
// shirt
g.fillRect(100, 300, 200, 200);
g.setColor(Color.WHITE);
g.fillRect(160, 300, 80, 200);
g.setColor(Color.BLACK);
g.fillRect(190, 300, 20, 200);
g.fillOval(180, 300, 40, 40);
// SIGN
g.setColor(Color.BLACK);
g.fillRect(350, 100, 350, 200);
g.setColor(Color.BLACK);
if (hover1)
g.setColor(Color.GRAY);
g.fillRect(350, 350, 150, 75);
g.setColor(Color.BLACK);
if (hover2)
g.setColor(Color.GRAY);
g.fillRect(550, 350, 150, 75);
g.setColor(Color.BLACK);
g.setFont(new Font("Roboto", Font.PLAIN, 15));
// WORDS
g.setColor(Color.WHITE);
g.setFont(Colours.title);
g.drawString("MEET THE PERSON", 200, 70);
g.setColor(Color.WHITE);
g.setFont(new Font("Roboto", Font.PLAIN, 25));
if (stage == 1) {
g.setFont(new Font("Roboto", Font.PLAIN, 25));
g.drawString("Hello, I am Jack!", 400, 160);
g.drawString("How are you doing?", 400, 250);
g.setFont(new Font("Roboto", Font.PLAIN, 15));
g.drawString("I am good", 370, 400);
g.drawString("I am not good", 570, 400);
} else if (stage == 2) {
g.setFont(new Font("Roboto", Font.PLAIN, 25));
g.drawString("That is cool! What", 400, 160);
g.drawString("class do you have?", 400, 250);
g.setFont(new Font("Roboto", Font.PLAIN, 15));
g.drawString("Science class", 370, 400);
g.drawString("Go away!", 570, 400);
} else if (stage == 3) {
g.setFont(new Font("Roboto", Font.PLAIN, 25));
g.drawString("Would you like to", 400, 160);
g.drawString("walk to class together?", 400, 250);
g.setFont(new Font("Roboto", Font.PLAIN, 15));
g.drawString("You are bald", 370, 400);
g.drawString("Sure!", 570, 400);
} else {
System.out.println("done");
MeetThePerson.isComplete = true;
}
g.setColor(Colours.darkerBlue);
g.fillRect(0, getHeight()-20, getWidth(),20);
}
}
}