-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMainGame.java
More file actions
51 lines (36 loc) · 897 Bytes
/
MainGame.java
File metadata and controls
51 lines (36 loc) · 897 Bytes
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
package dungeon;
import processing.core.PApplet;
import processing.event.KeyEvent;
public class MainGame extends PApplet {
public MainGame() {
}
@Override
public void settings() {
size(800,600);
}
@Override
public void setup() {
Player.getPlayerInstance("Giovanni", getGraphics());
Player.setPos(10,10);
}
@Override
public void draw() {
background(55);
update();
Player.draw();
}
@Override
public void keyPressed(KeyEvent event) {
switch (event.getKeyCode()) {
case 65 -> Player.move(-1, 0);
case 68 -> Player.move(1, 0);
case 87 -> Player.move(0,-1);
case 83 -> Player.move(0,1);
}
}
private void update() {
}
public static void main(String[] args) {
PApplet.main("dungeon.MainGame");
}
}