diff --git a/game/game.pde b/game/game.pde index c0dee16..5ccd8bd 100644 --- a/game/game.pde +++ b/game/game.pde @@ -26,6 +26,7 @@ int[][] level; + int test = 0; // The actual game void play() { // calculate actual position on ground @@ -47,6 +48,12 @@ void play() { helper(); // moveTiles(); + menuButton(); + + fill(0); + text(test, 700, 50); + test = test+3; + fill(255); } @@ -73,11 +80,20 @@ void collisionTest() { } } +int screenoffset = 0; + void moveTiles() { for (int i = 0; i < level.length; i++) { level[i][0] = level[i][0] - 3; + screenoffset++; } } +void moveTilesBack() { + for (int i = 0; i < level.length; i++) { + level[i][0] = level[i][0] + test; + } + test = 0; +} int baseline_y = 700; void baseline() { @@ -95,10 +111,3 @@ void newJump() { } -// Neat helper function, that gives us coordinates of point while clicking -void helper() { - if (mousePressed == true){ - println(mouseX, mouseY); - } - -} diff --git a/game/main.pde b/game/main.pde index 1415f16..88c547e 100644 --- a/game/main.pde +++ b/game/main.pde @@ -18,16 +18,9 @@ void saveFileChecker() { void draw() { - // rectMode(CENTER); - // rect(50, 50, 100, 50); - // textAlign(CENTER); - // fill(0); - // text("test", 50, 50); - // noFill(); - - // play(); // helper(); + debug(); if (ismenu) { mainMenu(); @@ -36,6 +29,7 @@ void draw() { } else if (iseditor) { mapEditor(); } + } boolean ismenu = true; @@ -44,6 +38,7 @@ boolean iseditor = false; void mainMenu() { + background(14, 181, 59); if (drawRectWithColission(width/2, height/2, 100, 100)) { if (mousePressed) { ismenu = false; @@ -58,10 +53,23 @@ void mainMenu() { } } +void menuButton() { + if (drawRectWithColission(50, 50, 80, 40)) { + if (mousePressed) { + ismenu = true; + iseditor = false; + isgame = false; + moveTilesBack(); + } + } +} + void mapEditor() { background(255); + baseline(); generate_editor_tiles(); // generate_tiles(); + menuButton(); } boolean drawRectWithColission(int x, int y, int rectwidth, int rectheight) { @@ -76,3 +84,15 @@ boolean drawRectWithColission(int x, int y, int rectwidth, int rectheight) { return false; } } + +void debug() { + // println(screenoffset); + // println(level[0][0]); +} + +// Neat helper function, that gives us coordinates of point while clicking +void helper() { + if (mousePressed == true){ + println(mouseX, mouseY); + } +}