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.InputProcessor;
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.TextureRegion;
import model.Goal;
import model.Level;
import model.Projectile;
@ -41,13 +44,18 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
batch = new SpriteBatch();
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.scheduleTask(new Timer.Task() {
@Override
public void run() {
level.step();
if(level.getProjectile().getxPos() > Gdx.graphics.getWidth() || level.getProjectile().getxPos() < 0 || level.getProjectile().getyPos() < 0){
level.reset();
}
else{
level.step();
}
}
}, 0, 0.01f);
stepTimer.stop();

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

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

Loading…
Cancel
Save