-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAaronPlatformer.pde
70 lines (53 loc) · 1.36 KB
/
AaronPlatformer.pde
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
//setup the game camera and player
Camera cam;
Player player;
float gravity;
ArrayList ground;
Controller controller;
void setup() {
size (500, 500);
background(255);
rectMode (CENTER);
player = new Player( new PVector(0, 0), new PVector(10, 25));
player.player.dim = new PVector(10, 25);
cam = new Camera();
controller = new Controller(player);
gravity = .1;//positive gravity, pulls down in code.
ground = new ArrayList();
ground.add(new Platform(new PVector(0, 50), new PVector(200, 10) ));
ground.add(new Platform(new PVector(100, 100), new PVector(50, 10) ));//<--------added this, caused problems.
player.player.beginComponents();
for (int i = 0; i < ground.size(); i++) {
Platform g = (Platform) ground.get(i);
g.platform.beginComponents();
}
}
void draw() {
background(255);
updateEarly();
cam.followPlayer();
update();
updateLate();
}
void updateEarly() {
player.updateEarly();
for (int i = 0; i < ground.size(); i++) {
Platform g = (Platform) ground.get(i);
g.updateEarly();
}
}
void update() {
controller.update();
player.update();
for (int i = 0; i < ground.size(); i++) {
Platform g = (Platform) ground.get(i);
g.update();
}
}
void updateLate() {
player.updateLate();
for (int i = 0; i < ground.size(); i++) {
Platform g = (Platform) ground.get(i);
g.updateLate();
}
}