-
Notifications
You must be signed in to change notification settings - Fork 0
/
Level.java
48 lines (39 loc) · 1.19 KB
/
Level.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
45
46
47
48
import processing.core.*;
import java.util.*;
public class Level {
public int[] playerSpawn, finishCoords;
private ArrayList<Platform> platforms;
public Level(PApplet p, int[] ps, int[][] pa, int[] goal) {
platforms = new ArrayList<Platform>();
playerSpawn = ps;
finishCoords = goal;
generatePlatformList(p, pa);
}
private void generatePlatformList(PApplet p, int[][] pa) {
for(int i = 0; i < pa.length; i++) {
platforms.add(new Platform(p, pa[i][0], pa[i][1], pa[i][2], pa[i][3]));
}
platforms.add(new Platform(p, -10, -1000, 10, p.height + 1000));
platforms.add(new Platform(p, p.width, -1000, 10, p.height + 1000));
}
public void displayPlatforms() {
for(Platform platform : platforms) {
platform.display();
}
}
public int getPlayerSpawnX() {
return playerSpawn[0];
}
public int getPlayerSpawnY() {
return playerSpawn[1];
}
public int getGoalX() {
return finishCoords[0];
}
public int getGoalY() {
return finishCoords[1];
}
public ArrayList<Platform> getPlatforms() {
return platforms;
}
}