diff --git a/android/assets/levelicon.png b/android/assets/levelicon.png new file mode 100644 index 0000000..10c3042 Binary files /dev/null and b/android/assets/levelicon.png differ diff --git a/android/assets/reseticon.png b/android/assets/reseticon.png new file mode 100644 index 0000000..db528e0 Binary files /dev/null and b/android/assets/reseticon.png differ diff --git a/android/assets/skipicon.png b/android/assets/skipicon.png new file mode 100644 index 0000000..1964684 Binary files /dev/null and b/android/assets/skipicon.png differ diff --git a/core/src/controller/Controller.java b/core/src/controller/Controller.java index 0e7ee82..318994d 100644 --- a/core/src/controller/Controller.java +++ b/core/src/controller/Controller.java @@ -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; } diff --git a/core/src/view/Winscreen.java b/core/src/view/Winscreen.java new file mode 100644 index 0000000..2ef28eb --- /dev/null +++ b/core/src/view/Winscreen.java @@ -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(); + } +}