GammelJan 6 years ago
parent 803131d896
commit 14cb073dd1

@ -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;
@ -44,6 +46,9 @@ public class Level {
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];
traces = new Vector2[isTraceInitialised.length];
@ -144,4 +149,7 @@ public class Level {
public boolean released(){
return isReleased;
}
public Polygon[] getPolygons(){
return polygons;
}
}

@ -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();
@ -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();

Loading…
Cancel
Save