diff --git a/core/src/controller/Controller.java b/core/src/controller/Controller.java index 474956f..d4ee048 100644 --- a/core/src/controller/Controller.java +++ b/core/src/controller/Controller.java @@ -23,6 +23,7 @@ import java.io.File; import java.util.ArrayList; import model.Level; +import view.Chapterscreen; import view.Gamescreen; import view.Levelscreen; import view.Leveleditor; @@ -45,6 +46,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ Gamescreen gs; Winscreen ws; Leveleditor le; + Chapterscreen cs; int levelAmount; SpriteBatch batch; Timer stepTimer; @@ -69,6 +71,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ gs = null; ws = null; le = null; + cs = null; levelAmount = 9; batch = new SpriteBatch(); Gdx.input.setInputProcessor(this); @@ -223,6 +226,9 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ ts = new Titlescreen(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT); } } + else if(cs != null){ + cs.render(batch); + } batch.end(); } @@ -257,7 +263,8 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ if(x > 0.05 * Gdx.graphics.getWidth()){ ts.dispose(); ts = null; - ls = new Levelscreen(beatenLevel, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera.combined); + //ls = new Levelscreen(beatenLevel, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera.combined); + cs = new Chapterscreen(5, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera.combined); } else{ ts.dispose(); @@ -306,6 +313,26 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ else if(le != null){ le.touchDown(x,y); } + else if(cs != null){ + if(cs.touchDown(x,y) == -1){ + + } + else if(cs.touchDown(x,y) == 6){ + cs.dispose(); + cs = null; + ts = new Titlescreen(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT); + } + else if(cs.touchDown(x,y) == 5){ + cs.dispose(); + cs = null; + le = new Leveleditor(GAME_WORLD_WIDTH,GAME_WORLD_HEIGHT,camera.combined); + } + else{ + cs.dispose(); + cs = null; + ls = new Levelscreen(9,GAME_WORLD_WIDTH,GAME_WORLD_HEIGHT,camera.combined); + } + } return true; } diff --git a/core/src/view/Chapterscreen.java b/core/src/view/Chapterscreen.java new file mode 100644 index 0000000..4767188 --- /dev/null +++ b/core/src/view/Chapterscreen.java @@ -0,0 +1,131 @@ +/* + * 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.Game; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input; +import com.badlogic.gdx.files.FileHandle; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.BitmapFont; +import com.badlogic.gdx.graphics.g2d.GlyphLayout; +import com.badlogic.gdx.graphics.g2d.Sprite; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator; +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; +import com.badlogic.gdx.math.Intersector; +import com.badlogic.gdx.math.Matrix4; +import com.badlogic.gdx.math.Rectangle; +import com.badlogic.gdx.utils.Timer; + +import java.util.ArrayList; + +import model.Button; +import model.Goal; +import model.Level; +import model.Projectile; + +/** + * + * @author Jan + */ +public class Chapterscreen{ + + int selectedChapter; + BitmapFont font; + int chapterAmount; + float GAME_WORLD_WIDTH; + float GAME_WORLD_HEIGHT; + ShapeRenderer shapeRenderer; + ArrayList