// } 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); } } } } int runnerRect = 0; void mouseReleased() { if(iseditor) { if (mouseButton == LEFT) { level[runnerRect][0] = mouseX+screenx; level[runnerRect][1] = mouseY; level[runnerRect][2] = 50; level[runnerRect][3] = 50; println("generated"); runnerRect = runnerRect + 1; println(runnerRect); } } }