From 3109e1916d6cb8a4db0ad006bcc740ca96619cbf Mon Sep 17 00:00:00 2001 From: GammelJan Date: Mon, 11 May 2020 21:50:51 +0200 Subject: [PATCH] eyeyey --- .../com/dungeoncrawler/control/Controller.java | 13 ++++++++++--- core/src/com/dungeoncrawler/model/Entity.java | 2 +- core/src/com/dungeoncrawler/model/Inventory.java | 4 +--- .../dungeoncrawler/model/entities/Player.java | 10 +++++----- core/src/com/dungeoncrawler/view/EndScreen.java | 16 ++++++++++++---- 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/core/src/com/dungeoncrawler/control/Controller.java b/core/src/com/dungeoncrawler/control/Controller.java index 2eb11fd..f2caaa8 100644 --- a/core/src/com/dungeoncrawler/control/Controller.java +++ b/core/src/com/dungeoncrawler/control/Controller.java @@ -36,11 +36,11 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ MainMenuScreen mm; GameScreen gs; - HudContainer hc; PauseScreen ps; SettingsScreen ss; ControlsScreen cs; + EndScreen es; // int tileX; @@ -274,6 +274,9 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ if(ps != null){ ps.render(batch, volume); } + if(es != null){ + es.render(batch, volume); + } //PASSIERT IN GAMESCREEN if(gs != null && mm == null && isPaused == false){ @@ -438,8 +441,9 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ roomPosX = roomAmount / 2; roomPosY = roomAmount / 2; } - else if (level >= 6){ - + else{ // Dungeon Exit + es = new EndScreen(); + gs = null; } } @@ -795,6 +799,9 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ gs.music.setVolume(volume); } return true; + case 11: + create(); + break; } if(gs != null && gs.getIsLoading() == false){ diff --git a/core/src/com/dungeoncrawler/model/Entity.java b/core/src/com/dungeoncrawler/model/Entity.java index 88081c8..aee2523 100644 --- a/core/src/com/dungeoncrawler/model/Entity.java +++ b/core/src/com/dungeoncrawler/model/Entity.java @@ -32,7 +32,7 @@ public abstract class Entity { } public boolean attack(Entity e){ - if(e.getHp() - this.dmg < 0){ + if(e.getHp() - this.dmg <= 0){ e.setHp(1); return true; } diff --git a/core/src/com/dungeoncrawler/model/Inventory.java b/core/src/com/dungeoncrawler/model/Inventory.java index 5dcb181..8943bc0 100644 --- a/core/src/com/dungeoncrawler/model/Inventory.java +++ b/core/src/com/dungeoncrawler/model/Inventory.java @@ -10,9 +10,7 @@ public class Inventory { int width; int height; - public Inventory(int width, int height){ - this.width = width; - this.height = height; + public Inventory(){ items = new Item[8]; selected = 2; } diff --git a/core/src/com/dungeoncrawler/model/entities/Player.java b/core/src/com/dungeoncrawler/model/entities/Player.java index 1711019..646d92e 100644 --- a/core/src/com/dungeoncrawler/model/entities/Player.java +++ b/core/src/com/dungeoncrawler/model/entities/Player.java @@ -29,16 +29,16 @@ public class Player extends Entity { this.standartDmg = dmg; id = -1; type = -1; - inv = new Inventory(3,2); + inv = new Inventory(); // TODO: Sinnvolle Werte finden this.targetsPlayer = false; } - public void updateStats(int lvl){ - this.lvl = lvl; - this.standartMaxHp = 100 * lvl; - this.standartDmg = 100 * lvl; + public void updateStats(int ey){ + lvl = ey; + standartMaxHp = 100 * ey; + standartDmg = 100 * ey; updateItems(); } diff --git a/core/src/com/dungeoncrawler/view/EndScreen.java b/core/src/com/dungeoncrawler/view/EndScreen.java index 7a3b465..517386b 100644 --- a/core/src/com/dungeoncrawler/view/EndScreen.java +++ b/core/src/com/dungeoncrawler/view/EndScreen.java @@ -7,6 +7,7 @@ package com.dungeoncrawler.view; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; @@ -19,7 +20,14 @@ import com.badlogic.gdx.math.Rectangle; */ public class EndScreen { + Sprite backButton; + + public EndScreen(){ + backButton = new Sprite(new Texture("sprites/backButton.png")); + backButton.setPosition(100, 100); + } + public void render (SpriteBatch batch, float volume) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); @@ -30,10 +38,10 @@ public class EndScreen { public int click(int x, int y){ // prueft ob cursor mit button (START) ueberlappt - - //if(Intersector.overlaps(r, backButtonSprite.getBoundingRectangle())){ - // return 5; //proceed Game - //} + Rectangle r = new Rectangle(x,y,1,1); + if(Intersector.overlaps(r, backButton.getBoundingRectangle())){ + return 11; //NEUSTART + } return -1;