old map thing
This commit is contained in:
parent
ca87f13623
commit
92a6ace93b
60
map/map.pde
60
map/map.pde
@ -1,7 +1,6 @@
|
|||||||
JSONArray json;
|
|
||||||
|
|
||||||
void setup() {
|
// void setup() {
|
||||||
size(800,800);
|
// size(800,800);
|
||||||
// json = loadJSONArray("map.json");
|
// json = loadJSONArray("map.json");
|
||||||
|
|
||||||
// JSONObject values = json.getJSONObject(1);
|
// JSONObject values = json.getJSONObject(1);
|
||||||
@ -9,46 +8,49 @@ void setup() {
|
|||||||
// int x = values.getInt("x");
|
// int x = values.getInt("x");
|
||||||
// print(x);
|
// print(x);
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
void draw() {
|
// void draw() {
|
||||||
background(255);
|
// background(255);
|
||||||
generate_tiles();
|
// generate_tiles();
|
||||||
}
|
// }
|
||||||
|
|
||||||
PVector tilesize = new PVector(50, 50);
|
|
||||||
int[] tiles_x = {50};
|
|
||||||
int[] tiles_y = {50};
|
|
||||||
void pickTiles() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void generate_tiles() {
|
void generate_tiles() {
|
||||||
for (int i = 0; i < tiles_x.length; i++ ) {
|
for (int i = 0; i < level.length; i++ ) {
|
||||||
rect(tiles_x[i], tiles_y[i], tilesize.x, tilesize.y);
|
rect(level[i][0]-screenx, level[i][1], level[i][2], level[i][3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int runnerRect = 0;
|
||||||
void mouseReleased() {
|
void mouseReleased() {
|
||||||
tiles_x = (int[])append(tiles_x, mouseX);
|
level[runnerRect][0] = mouseX+screenx;
|
||||||
tiles_y = (int[])append(tiles_y, mouseY);
|
level[runnerRect][1] = mouseY;
|
||||||
|
level[runnerRect][2] = 50;
|
||||||
println(tiles_x);
|
level[runnerRect][3] = 50;
|
||||||
|
println("generated");
|
||||||
|
runnerRect = runnerRect + 1;
|
||||||
|
println(runnerRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void keyPressed() {
|
int[][] level = new int[100][4];
|
||||||
if (key == 's') {
|
JSONArray json;
|
||||||
println("saved");
|
|
||||||
|
int savetofile(String filename) {
|
||||||
json = new JSONArray();
|
json = new JSONArray();
|
||||||
|
|
||||||
for (int i = 0; i < tiles_x.length; i++) {
|
for (int i = 0; i < level.length; i++) {
|
||||||
|
|
||||||
JSONArray mapsave = new JSONArray();
|
JSONArray mapsave = new JSONArray();
|
||||||
mapsave.setInt(0, tiles_x[i]);
|
mapsave.setInt(0, level[i][0]);
|
||||||
mapsave.setInt(1, tiles_y[i]);
|
mapsave.setInt(1, level[i][1]);
|
||||||
|
mapsave.setInt(2, level[i][2]);
|
||||||
|
mapsave.setInt(3, level[i][3]);
|
||||||
|
|
||||||
json.setJSONArray(i, mapsave);
|
json.setJSONArray(i, mapsave);
|
||||||
}
|
}
|
||||||
saveJSONArray(json, "map.json");
|
saveJSONArray(json, filename + ".json");
|
||||||
}
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int screenx = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user