From 14cb073dd158f00a5286173e7b1965d77aee9a6c Mon Sep 17 00:00:00 2001 From: GammelJan Date: Fri, 19 Jun 2020 19:42:20 +0200 Subject: [PATCH] lol --- core/src/model/Level.java | 8 ++++++++ core/src/view/Gamescreen.java | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/core/src/model/Level.java b/core/src/model/Level.java index 5013791..1a621cc 100644 --- a/core/src/model/Level.java +++ b/core/src/model/Level.java @@ -5,6 +5,7 @@ */ package model; +import com.badlogic.gdx.math.Polygon; import com.badlogic.gdx.math.Vector2; import com.throwgame.main.ThrowMath; @@ -30,6 +31,7 @@ public class Level { private int traceIndex; public boolean[] isTraceInitialised; public Vector2[] traces; + Polygon[] polygons; public Level(Goal goal, Projectile projectile, int xPosPivot, int yPosPivot){ this.goal = goal; @@ -43,6 +45,9 @@ public class Level { this.yPosPivot = yPosPivot; this.angle = 0; this.angleSpeed = 0; + + polygons = new Polygon[1]; + polygons[0] = new Polygon(new float[]{500,500,502,500,602,600,600,600}); traceIndex = 0; isTraceInitialised = new boolean[50]; @@ -144,4 +149,7 @@ public class Level { public boolean released(){ return isReleased; } + public Polygon[] getPolygons(){ + return polygons; + } } diff --git a/core/src/view/Gamescreen.java b/core/src/view/Gamescreen.java index 065b550..e64fa66 100644 --- a/core/src/view/Gamescreen.java +++ b/core/src/view/Gamescreen.java @@ -14,7 +14,9 @@ import com.badlogic.gdx.math.Circle; import com.badlogic.gdx.math.Intersector; import com.badlogic.gdx.math.Matrix4; import com.badlogic.gdx.math.Rectangle; +import com.badlogic.gdx.math.Polygon; import com.badlogic.gdx.math.Vector2; +import java.awt.Point; import model.Goal; import model.Level; @@ -48,6 +50,7 @@ public class Gamescreen{ // 0: Left, 1: LeftTop, 2: CenterLeft, 3: CenterBottom, 4: CenterRight, 5: RightTop, 6: Right, 7: Bottom float GAME_WORLD_WIDTH; float GAME_WORLD_HEIGHT; + Polygon[] objects; boolean win; @@ -57,6 +60,7 @@ public class Gamescreen{ pivotX = level.getPivotX(); pivotY = level.getPivotY(); g = level.getGoal(); + objects = level.getPolygons(); x = g.getxPos(); y = g.getyPos(); w = g.getSizeX(); @@ -77,7 +81,7 @@ public class Gamescreen{ goalRects[5] = new Rectangle(x + th*4 * w ,y + h - 1f ,w *th ,1 ); goalRects[6] = new Rectangle(x + w-1 ,y ,1 ,h ); goalRects[7] = new Rectangle(x ,y ,w ,1 ); - + goalRect = new Rectangle(x + w*th, y + h*th, w * th * 3, h * 0.1f); projectileCirc = new Circle((float)level.getProjectile().getxPos(), (float)level.getProjectile().getyPos(), level.getProjectile().getRadius()); @@ -109,6 +113,8 @@ public class Gamescreen{ shapeRenderer.rectLine((float) level.getPivotX(), (float) level.getPivotY(), (float) level.getProjectile().getxPos(), (float) level.getProjectile().getyPos(), 3); } + + shapeRenderer.setColor(Color.BLACK); shapeRenderer.rect(x, y,th * w, h); shapeRenderer.rect(x + th * w,y, th*3 * w,th * h); @@ -132,6 +138,16 @@ public class Gamescreen{ shapeRenderer.setColor(Color.GRAY); shapeRenderer.circle(pivotX, pivotY, 5); + + + + shapeRenderer.end(); + + shapeRenderer.begin(ShapeRenderer.ShapeType.Line); + shapeRenderer.setColor(Color.BLACK); + for(Polygon object : objects){ + shapeRenderer.polygon(objects[0].getVertices()); + } shapeRenderer.end();