master
GammelJan 6 years ago
parent 4971f42fe2
commit 1a70e05641

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

@ -9,7 +9,10 @@ import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor; import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.graphics.GL20; 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.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import model.Goal; import model.Goal;
import model.Level; import model.Level;
import model.Projectile; import model.Projectile;
@ -41,14 +44,19 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
batch = new SpriteBatch(); batch = new SpriteBatch();
Gdx.input.setInputProcessor(this); Gdx.input.setInputProcessor(this);
level = new Level(new Goal(1000,500,200,150), new Projectile(0,0,0),400,400); level = new Level(new Goal(1300,700,200,80), new Projectile(0,0,0),400,400);
stepTimer = new Timer(); stepTimer = new Timer();
stepTimer.scheduleTask(new Timer.Task() { stepTimer.scheduleTask(new Timer.Task() {
@Override @Override
public void run() { public void run() {
if(level.getProjectile().getxPos() > Gdx.graphics.getWidth() || level.getProjectile().getxPos() < 0 || level.getProjectile().getyPos() < 0){
level.reset();
}
else{
level.step(); level.step();
} }
}
}, 0, 0.01f); }, 0, 0.01f);
stepTimer.stop(); stepTimer.stop();
} }

@ -14,7 +14,7 @@ import com.throwgame.main.ThrowMath;
*/ */
public class Level { public class Level {
private final double G = 0.05; private final double G = 0.05;
private final int RADIUS = 100; private final int RADIUS = 150;
private Goal goal; private Goal goal;
private Projectile projectile; private Projectile projectile;
@ -80,6 +80,14 @@ public class Level {
*/ */
} }
public void reset(){
isReleased = false;
projectile.setxPos(xPosPivot + RADIUS);
projectile.setyPos(yPosPivot);
angle = 0;
angleSpeed = 0;
}
public Goal getGoal() { public Goal getGoal() {
return goal; return goal;
} }

@ -9,8 +9,8 @@ public class DesktopLauncher {
public static void main (String[] arg) { public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
//config.fullscreen = true; //config.fullscreen = true;
config.height = 720; config.height = 900;
config.width = 1280; config.width = 1600;
new LwjglApplication(new Controller(), config); new LwjglApplication(new Controller(), config);
} }
} }

Loading…
Cancel
Save