diff --git a/core/src/controller/Controller.java b/core/src/controller/Controller.java index ad2a595..e41800d 100644 --- a/core/src/controller/Controller.java +++ b/core/src/controller/Controller.java @@ -17,6 +17,7 @@ import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.utils.Json; import com.badlogic.gdx.utils.Timer; import com.badlogic.gdx.utils.viewport.ExtendViewport; +import com.badlogic.gdx.utils.viewport.FillViewport; import com.badlogic.gdx.utils.viewport.FitViewport; import com.badlogic.gdx.utils.viewport.StretchViewport; import com.badlogic.gdx.utils.viewport.Viewport; @@ -82,7 +83,12 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ float aspectRatio = (float)Gdx.graphics.getHeight() / (float)Gdx.graphics.getWidth(); camera = new OrthographicCamera(); - viewport = new StretchViewport(GAME_WORLD_WIDTH/* *aspectRatio*/, GAME_WORLD_HEIGHT, camera); + //if(aspectRatio == (9f/16f)){ + // viewport = new StretchViewport(GAME_WORLD_WIDTH/* *aspectRatio*/, GAME_WORLD_HEIGHT, camera); + //} + //else{ + viewport = new FitViewport(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera); + //} viewport.apply(); camera.position.set(GAME_WORLD_WIDTH/2, GAME_WORLD_HEIGHT/2, 0); diff --git a/core/src/view/Gamescreen.java b/core/src/view/Gamescreen.java index f07e60c..d5d450f 100644 --- a/core/src/view/Gamescreen.java +++ b/core/src/view/Gamescreen.java @@ -87,13 +87,11 @@ public class Gamescreen{ goalRects[6] = new Rectangle(x + w-1 ,y ,1 ,h ); goalRects[7] = new Rectangle(x ,y ,w ,1 ); - if(objects != null) { - for (Rectangle object : objects) { - objectRects.add(new Rectangle(object.getX(), object.getY(), 1, object.getHeight())); - objectRects.add(new Rectangle(object.getX(), object.getY() + object.getHeight() - 1, object.getWidth(), 1)); - objectRects.add(new Rectangle(object.getX() + object.getWidth() - 1, object.getY(), 1, object.getHeight())); - objectRects.add(new Rectangle(object.getX(), object.getY(), object.getWidth(), 1)); - } + for (Rectangle object : objects) { + objectRects.add(new Rectangle(object.getX(), object.getY(), 1, object.getHeight())); + objectRects.add(new Rectangle(object.getX(), object.getY() + object.getHeight() - 1, object.getWidth(), 1)); + objectRects.add(new Rectangle(object.getX() + object.getWidth() - 1, object.getY(), 1, object.getHeight())); + objectRects.add(new Rectangle(object.getX(), object.getY(), object.getWidth(), 1)); } goalRect = new Rectangle(x + w*th, y + h*th, w * th * 3, h * 0.1f); diff --git a/desktop/src/com/throwgame/main/desktop/DesktopLauncher.java b/desktop/src/com/throwgame/main/desktop/DesktopLauncher.java index b7cffc6..317337e 100644 --- a/desktop/src/com/throwgame/main/desktop/DesktopLauncher.java +++ b/desktop/src/com/throwgame/main/desktop/DesktopLauncher.java @@ -8,9 +8,9 @@ import controller.Controller; public class DesktopLauncher { public static void main (String[] arg) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); - //config.fullscreen = true; - config.height = 720; - config.width = 1280; + config.fullscreen = true; + config.height = 2560; + config.width = 3840; new LwjglApplication(new Controller(), config); } } diff --git a/levels/level2.json b/levels/level2.json index 6a280bb..12874cd 100644 --- a/levels/level2.json +++ b/levels/level2.json @@ -1 +1 @@ -{goal:{xPos:1556,yPos:774,sizeX:300,sizeY:200,thickness:0.2},projectile:{xPos:698,yPos:677,mass:5,radius:10},math:{},xPosPivot:698,yPosPivot:527,isTraceInitialised:[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],traces:[{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10}],objects:[{x:590,y:705,width:200,height:100},{x:705,y:690,width:200,height:100},{x:816,y:628,width:200,height:100},{x:896,y:557,width:200,height:100},{x:908,y:478,width:200,height:100},{x:902,y:380,width:200,height:100},{x:833,y:269,width:200,height:100},{x:880,y:325,width:200,height:100},{x:720,y:237,width:200,height:100},{x:596,y:245,width:200,height:100},{x:458,y:269,width:200,height:100},{x:356,y:367,width:200,height:100},{x:312,y:538,width:200,height:100},{x:287,y:459,width:200,height:100},{x:340,y:630,width:200,height:100},{x:410,y:697,width:200,height:100}]} \ No newline at end of file +{goal:{xPos:1126,yPos:430,sizeX:300,sizeY:200,thickness:0.2},projectile:{xPos:528,yPos:629,mass:5,radius:10},math:{},xPosPivot:528,yPosPivot:479,isTraceInitialised:[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],traces:[{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10},{x:-10,y:-10}],objects:[{x:464,y:556,width:200,height:100}]} \ No newline at end of file