-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKOScreen.java
More file actions
38 lines (35 loc) · 1.17 KB
/
KOScreen.java
File metadata and controls
38 lines (35 loc) · 1.17 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
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class KOScreen implements ActionListener{
Button cont = new Button("Restart Round"), exit = new Button("Exit to Main Menu");
ArrayList<Image> img = new ArrayList<Image>();
public KOScreen(int widthLimit, int heightLimit){
cont.setBounds(widthLimit/2 - 125, heightLimit/2 + 100, 250, 50);
cont.addActionListener(this);
exit.setBounds(10,35, 250, 50);
exit.addActionListener(this);
hideButtons();
}
void showButtons(ArrayList<Character> c){
img.clear();
for(int i = 0; i < c.size(); i++){
img.add(c.get(i).koImage);
}
cont.setVisible(true);
exit.setVisible(true);
}
void hideButtons(){
cont.setVisible(false);
exit.setVisible(false);
}
public void paint(Graphics g, int widthLimit){
g.drawString("You have died", widthLimit/2 - 200, 200);
for(int i = 0; i < img.size(); i++){
g.drawImage(img.get(i), widthLimit/6 + (widthLimit/3) * i, 250, null);
}
}
public void actionPerformed(ActionEvent e){
hideButtons();
}
}