-
Notifications
You must be signed in to change notification settings - Fork 0
/
BackGround.java
44 lines (39 loc) · 1.03 KB
/
BackGround.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
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JApplet;
public class BackGround extends ScreenObject {
ScreenManager sm;
Level level;
Boolean[][] bg = new Boolean[30][30];
JApplet parent;
public BackGround(int x, int y, int w, int h, ScreenManager sm) {
super(x, y, w, h);
this.sm = sm;
for (int i = 0; i < 30; i++) {
for (int j = 0; j < 30; j++) {
bg[i][j] = true;
}
}
for (int i = 0; i < 30; i++) {
bg[i][0] = false;
}
}
@Override
public void draw(Graphics g) {
g.setColor(Color.ORANGE);
for (int i = 0; i < 30; i++) {
for (int j = 0; j < 30; j++) {
if (bg[i][j] == true) {
g.fillRect(i * 20, j * 20, 20, 20);
}
}
}
}
public void fillAll () {
for (int i = 0; i < 30; i++) {
for (int j = 0; j < 30; j++) {
bg[i][j]=true;
}
}
}
}