35 lines
837 B
Plaintext
35 lines
837 B
Plaintext
// } else if (key == 'l') {
|
|
// println(loadJSONArray("../map/map.json"));
|
|
|
|
void keyPressed () {
|
|
if (ismenu) {
|
|
} else if (isgame) {
|
|
if (key == CODED) {
|
|
if (keyCode == RIGHT) {
|
|
direction.x = +1;
|
|
pos.x = pos.x + direction.x * speed;
|
|
} else if (keyCode == LEFT) {
|
|
direction.x = -1;
|
|
pos.x = pos.x + direction.x * speed;
|
|
}
|
|
} else if (key == ' ') {
|
|
jumpspeed =+ 25;
|
|
}
|
|
} else if (iseditor) {
|
|
if (key == 's') {
|
|
savetofile("save");
|
|
println("saved");
|
|
} else if (key == CODED) {
|
|
if (keyCode == RIGHT) {
|
|
screenx = screenx + 50;
|
|
println("moved right!");
|
|
println(screenx);
|
|
} else if (keyCode == LEFT) {
|
|
screenx = screenx - 50;
|
|
println("moved right!");
|
|
println(screenx);
|
|
}
|
|
}
|
|
}
|
|
}
|