From 8dfd9a445a3a78615f16a140eda929fd9ba13143 Mon Sep 17 00:00:00 2001 From: GammelJAN Date: Sat, 26 Sep 2020 11:09:44 +0200 Subject: [PATCH] wall can't overdraw projectile --- core/src/com/trs/game/Controller.java | 1 + core/src/com/trs/game/model/Model.java | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/core/src/com/trs/game/Controller.java b/core/src/com/trs/game/Controller.java index 6034cc8..c26d339 100644 --- a/core/src/com/trs/game/Controller.java +++ b/core/src/com/trs/game/Controller.java @@ -217,6 +217,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor { screen = new MainMenuScreen(GAME_WORLD_WIDTH,GAME_WORLD_HEIGHT); break; case 1: //GOTO GAMESCREEN + model = new Model(); screen = new GameScreen(GAME_WORLD_WIDTH,GAME_WORLD_HEIGHT); break; case 2: //GOTO ENDSCREEN diff --git a/core/src/com/trs/game/model/Model.java b/core/src/com/trs/game/model/Model.java index 884bebd..e4ef8dd 100644 --- a/core/src/com/trs/game/model/Model.java +++ b/core/src/com/trs/game/model/Model.java @@ -62,6 +62,12 @@ public class Model { break; } } + for(Projectile projectile : projectiles){ + if(Intersector.overlapConvexPolygons(tempPolygon,projectile.getPolygon())){ + possible = false; + break; + } + } if(possible){ leftWallLength -= Vector2.dst(tempStart.x,tempStart.y,x,y);