From ca87f13623b78f0df0f4a60f447187a43f603696 Mon Sep 17 00:00:00 2001 From: Makussu Date: Sat, 21 Oct 2023 00:41:17 +0200 Subject: [PATCH] yes --- game/game.pde | 5 ++--- game/main.pde | 21 +++++++++++---------- game/map.pde | 38 +++++++++++++++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 16 deletions(-) diff --git a/game/game.pde b/game/game.pde index b4521fe..74e9df3 100644 --- a/game/game.pde +++ b/game/game.pde @@ -35,7 +35,6 @@ void play() { // calculate actual position on ground // actualPos = height - pos.y; - background(255); // player rectMode(CENTER); @@ -85,8 +84,8 @@ void newJump() { // TODO Collision erweitern wie in https://happycoding.io/tutorials/processing/collision-detection void collisionTest() { // Collision with baseline - if ( pos.y > 0.875*height - playerRadius/2 ) { - pos.set(pos.x, 0.875*height - playerRadius/2); + if ( pos.y > 0.850*height - playerRadius/2 ) { + pos.set(pos.x, 0.850*height - playerRadius/2); } // Collision with all the tiles bottom site diff --git a/game/main.pde b/game/main.pde index 5a23404..8a81dc7 100644 --- a/game/main.pde +++ b/game/main.pde @@ -4,8 +4,8 @@ void setup() { smooth(4); - drawBackground(); - // level = loadJson("./saves/save.json"); + + level = loadJson("./saves/save.json"); } // not done yet @@ -22,13 +22,14 @@ void saveFileChecker() { void draw() { // debug(); - // if (ismenu) { - // mainMenu(); - // } else if (isgame) { - // play(); - // } else if (iseditor) { - // mapEditor(); - // } + if (ismenu) { + mainMenu(); + } else if (isgame) { + drawBackground(); + play(); + } else if (iseditor) { + mapEditor(); + } } boolean ismenu = true; @@ -53,7 +54,7 @@ void mainMenu() { } } // exit game - if (drawRectWithMouseColission(50, 50, 80, 40)) { + if (drawRectWithMouseColission(50, 100, 80, 40)) { if (mousePressed) { exit(); } diff --git a/game/map.pde b/game/map.pde index de45f25..815c816 100644 --- a/game/map.pde +++ b/game/map.pde @@ -24,12 +24,44 @@ void generate_editor_tiles() { } void baseRect() { - line(0, 0.875*height, width, 0.875*height); - fill(100); - quad(0, 0.875*height, width, 0.875*height, width, height, 0, height); + line(0, 0.850*height, width, 0.850*height); fill(255); } +// Background +void drawBackground() { + color sky = color(94, 218, 252); + color sand = color(235, 218, 174); + color darksand = color(232, 177, 120); + color sea = color(51, 169, 255); + color seaend = color(146, 254, 255); + + // sky + background(sky); + // sea + // for(int y = 400; y < 650; y++){ + // float inter = map(y, 400, 650, 0, 1); + // color c = lerpColor(sea, seaend, inter); + // stroke(c); + // line(0, y, width, y); + // noStroke(); + // } + fill(sea); + quad(0, 400, width, 400, width, 650, 0, 650); + // Beach + fill(sand); + quad(0, 650, width, 650, width, height, 0, height); + // Player stands on this + fill(darksand); + quad(0, 0.850*height, width, 0.850*height, width, height, 0, height); + fill(0); +} + +void drawCloud() { + ellipse(224, 184, 220, 220); +} + + //// This Handles loading and saving the level // TODO Check if json is empty. If it is generate level // int[][] level = new int[100][4];