GammelJan 6 years ago
parent 9422474268
commit 49d7b0d036

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

@ -20,6 +20,7 @@ import view.Gamescreen;
import view.Levelscreen;
import com.badlogic.gdx.utils.Timer;
import view.Titlescreen;
import view.Winscreen;
/**
*
@ -30,6 +31,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
Titlescreen ts;
Levelscreen ls;
Gamescreen gs;
Winscreen ws;
int levelAmount;
SpriteBatch batch;
Timer stepTimer;
@ -40,6 +42,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
ts = new Titlescreen();
ls = null;
gs = null;
ws = null;
levelAmount = 10;
batch = new SpriteBatch();
Gdx.input.setInputProcessor(this);
@ -50,12 +53,16 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
stepTimer.scheduleTask(new Timer.Task() {
@Override
public void run() {
if(gs != null){
if(level.getProjectile().getxPos() > Gdx.graphics.getWidth() || level.getProjectile().getxPos() < 0 || level.getProjectile().getyPos() < 0){
level.reset();
gs = null;
ws = new Winscreen();
}
else{
level.step();
}
}
}
}, 0, 0.01f);
stepTimer.stop();
@ -69,6 +76,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
if(ts != null) ts.render(batch);
else if(ls != null) ls.render(batch);
else if(gs != null) gs.render(batch, level);
else if(ws != null) ws.render(batch);
batch.end();
}
@ -120,6 +128,18 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
level.projectileReleased();
}
}
else if(ws != null){
if(x < Gdx.graphics.getWidth() * 0.25){
ls = new Levelscreen(levelAmount);
}
else if(x < Gdx.graphics.getWidth() * 0.75){
gs = new Gamescreen(level);
}
else{
gs = new Gamescreen(level);
}
ws = null;
}
return true;
}

@ -0,0 +1,61 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package view;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.Timer;
/**
*
* @author Jan
*/
public class Winscreen{
BitmapFont font;
Timer t;
Sprite reset;
Sprite level;
Sprite next;
public Winscreen(){
t = new Timer();
int w = Gdx.graphics.getWidth();
int h = Gdx.graphics.getHeight();
next = new Sprite(new Texture("skipicon.png"));
next.setPosition(w * 0.75f - next.getWidth()/2, h/2 - next.getHeight()/4);
level = new Sprite(new Texture("levelicon.png"));
level.setPosition(w * 0.25f - level.getWidth()/2, h/2 - level.getHeight()/4);
reset = new Sprite(new Texture("reseticon.png"));
reset.setPosition(w/2 - reset.getWidth()/2, h/2 - reset.getHeight()/2);
t.scheduleTask(new Timer.Task() {
@Override
public void run() {
}
},0 , 0.035f);
}
public void render(SpriteBatch batch) {
next.draw(batch);
level.draw(batch);
reset.draw(batch);
}
public void dispose() {
t.clear();
}
}
Loading…
Cancel
Save