Jan Ehehalt 6 years ago
parent 1393b053f8
commit 2124035fa2

@ -54,7 +54,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
@Override
public void create(){
ts = new Titlescreen();
ts = new Titlescreen(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
ls = null;
gs = null;
ws = null;
@ -81,7 +81,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
level.reset();
gs.dispose();
gs = null;
ws = new Winscreen();
ws = new Winscreen(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
}
else{
level.step();
@ -139,7 +139,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
if(ts != null){
ts.dispose();
ts = null;
ls = new Levelscreen(levelAmount);
ls = new Levelscreen(levelAmount, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
}
else if(ls != null){
if(x < Gdx.graphics.getWidth() * 0.15){
@ -152,7 +152,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
else{
ls.dispose();
ls = null;
gs = new Gamescreen(level);
gs = new Gamescreen(level, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
stepTimer.start();
}
}
@ -163,13 +163,13 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
}
else if(ws != null){
if(x < Gdx.graphics.getWidth() * 0.33){
ls = new Levelscreen(levelAmount);
ls = new Levelscreen(levelAmount, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
}
else if(x < Gdx.graphics.getWidth() * 0.66){
gs = new Gamescreen(level);
gs = new Gamescreen(level, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
}
else{
gs = new Gamescreen(level);
gs = new Gamescreen(level, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
}
ws = null;
}

@ -32,9 +32,12 @@ public class Gamescreen{
int pivotX;
int pivotY;
float GAME_WORLD_WIDTH;
float GAME_WORLD_HEIGHT;
public Gamescreen(Level level){
public Gamescreen(Level level, float width, float height){
GAME_WORLD_WIDTH = width;
GAME_WORLD_HEIGHT = height;
pivotX = level.getPivotX();
pivotY = level.getPivotY();
g = level.getGoal();
@ -77,6 +80,7 @@ public class Gamescreen{
shapeRenderer.circle((float) p.getxPos(), (float) p.getyPos(), p.getRadius());
shapeRenderer.setColor(Color.GRAY);
shapeRenderer.circle(pivotX, pivotY, 5);
shapeRenderer.circle(0,0,5);
shapeRenderer.end();

@ -33,14 +33,18 @@ public class Levelscreen{
Timer t;
boolean movement;
int levelAmount;
float GAME_WORLD_WIDTH;
float GAME_WORLD_HEIGHT;
public Levelscreen(int levelAmount){
public Levelscreen(int levelAmount, float width, float height){
GAME_WORLD_WIDTH = width;
GAME_WORLD_HEIGHT = height;
levelPreview = new Sprite[levelAmount];
buttonRight = new Sprite(new Texture("buttonRight.png"));
buttonRight.setY(Gdx.graphics.getHeight() / 2 - buttonRight.getHeight() / 2);
buttonRight.setX(Gdx.graphics.getWidth() - 10 - buttonRight.getWidth());
buttonRight.setY(GAME_WORLD_HEIGHT/ 2 - buttonRight.getHeight() / 2);
buttonRight.setX(GAME_WORLD_WIDTH - 10 - buttonRight.getWidth());
buttonLeft = new Sprite(new Texture("buttonLeft.png"));
buttonLeft.setY(Gdx.graphics.getHeight() / 2 - buttonLeft.getHeight() / 2);
buttonLeft.setY(GAME_WORLD_HEIGHT / 2 - buttonLeft.getHeight() / 2);
buttonLeft.setX(10);
selectedLevel = 0;
this.levelAmount = levelAmount;
@ -56,7 +60,7 @@ public class Levelscreen{
if(buttonLeft.getX() <= 0){
movement = true;
}
if(buttonLeft.getX() + buttonLeft.getWidth() > Gdx.graphics.getWidth() * 0.12){
if(buttonLeft.getX() + buttonLeft.getWidth() > GAME_WORLD_WIDTH * 0.12){
movement = false;
}
if(movement){
@ -79,7 +83,7 @@ public class Levelscreen{
if(selectedLevel < levelAmount){
buttonRight.draw(batch);
}
font.draw(batch, "" + selectedLevel, Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
font.draw(batch, "" + selectedLevel, GAME_WORLD_WIDTH / 2, GAME_WORLD_HEIGHT / 2);
}

@ -26,20 +26,24 @@ public class Titlescreen{
Timer t;
Sprite clicktostart;
boolean movement;
float GAME_WORLD_WIDTH;
float GAME_WORLD_HEIGHT;
public Titlescreen(){
public Titlescreen(float width, float height){
this.GAME_WORLD_WIDTH = width;
this.GAME_WORLD_HEIGHT = height;
movement = true;
clicktostart = new Sprite(new Texture(Gdx.files.internal("clicktostart.png")));
clicktostart.setX(Gdx.graphics.getWidth() / 2 - clicktostart.getWidth() / 2);
clicktostart.setY(Gdx.graphics.getHeight() / 2 - clicktostart.getHeight() / 2);
clicktostart.setX(GAME_WORLD_WIDTH / 2 - clicktostart.getWidth() / 2);
clicktostart.setY(GAME_WORLD_HEIGHT / 2 - clicktostart.getHeight() / 2);
t = new Timer();
t.scheduleTask(new Timer.Task() {
@Override
public void run() {
if(clicktostart.getY() < Gdx.graphics.getHeight() * 0.4)
if(clicktostart.getY() < GAME_WORLD_HEIGHT * 0.4)
movement = true;
else if(clicktostart.getY() > Gdx.graphics.getHeight() * 0.5)
else if(clicktostart.getY() > GAME_WORLD_HEIGHT * 0.5)
movement = false;
if(movement)
clicktostart.setY(clicktostart.getY() + 3);

@ -27,17 +27,22 @@ public class Winscreen{
Sprite win;
boolean movement;
float GAME_WORLD_WIDTH;
float GAME_WORLD_HEIGHT;
public Winscreen(){
public Winscreen(float width, float height){
t = new Timer();
GAME_WORLD_WIDTH = width;
GAME_WORLD_HEIGHT = height;
/*
movement = true;
win = new Sprite(new Texture(Gdx.files.internal("win.png")));
win.setX(Gdx.graphics.getWidth() / 2 - win.getWidth() / 2);
win.setY(Gdx.graphics.getHeight() * 0.7f - win.getHeight() / 2);
win.setX(GAME_WORLD_WIDTH / 2 - win.getWidth() / 2);
win.setY(GAME_WORLD_HEIGHT * 0.7f - win.getHeight() / 2);
*/
int w = Gdx.graphics.getWidth();
int h = Gdx.graphics.getHeight();
float w = GAME_WORLD_WIDTH;
float h = GAME_WORLD_HEIGHT;
next = new Sprite(new Texture("skipicon.png"));
next.setPosition(w * 0.75f - next.getWidth()/2, h*0.35f - next.getHeight()/2);
@ -51,9 +56,9 @@ public class Winscreen{
t.scheduleTask(new Timer.Task() {
@Override
public void run() {
/*if(win.getY() < Gdx.graphics.getHeight()*0.8)
/*if(win.getY() < GAME_WORLD_HEIGHT*0.8)
movement = true;
else if(win.getY() > Gdx.graphics.getHeight() * 0.7)
else if(win.getY() > GAME_WORLD_HEIGHT * 0.7)
movement = false;
if(movement)
win.setY(win.getY() + 3);

Loading…
Cancel
Save