-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAsteroids_Train.pde
51 lines (44 loc) · 993 Bytes
/
Asteroids_Train.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
import java.util.ArrayList;
GameScene GS;
Locals locals;
void setup(){
locals = new Locals();
size(900, 900, OPENGL);
frameRate(60);
locals.player = new Ship(locals);
locals.asteroids = new ArrayList<Asteroid>();
GS = new GameScene(locals);
// locals.level = 10;
}
void draw(){
GS.show();
// System.out.println(player.score + " - " + player.dead);
}
/**
* Button released handle.
*/
void keyReleased(){
int code;
if (keyCode > 40){
code = int(Character.toLowerCase(key));
}
else{
code = keyCode;
}
locals.player.processButtonReleased(int(Character.toLowerCase(code)));
}
/**
* Button pressed handle.
*/
void keyPressed(){
// char k = key;
//System.out.println(keyCode);
int code;
if (keyCode > 40){
code = int(Character.toLowerCase(key));
}
else{
code = keyCode;
}
locals.player.processButtonPress(code);
}