diff --git a/android/assets/levels/plevel002.tmx b/android/assets/levels/plevel002.tmx index a84af92..2ba605a 100644 --- a/android/assets/levels/plevel002.tmx +++ b/android/assets/levels/plevel002.tmx @@ -1,6 +1,6 @@ - + @@ -3521,9 +3521,9 @@ - - - + + + @@ -4021,9 +4021,9 @@ - - + + @@ -4523,7 +4523,7 @@ - + @@ -5023,7 +5023,7 @@ - + @@ -5523,7 +5523,7 @@ - + @@ -6023,7 +6023,7 @@ - + @@ -6523,7 +6523,7 @@ - + @@ -7023,7 +7023,7 @@ - + @@ -7523,7 +7523,7 @@ - + @@ -8023,7 +8023,7 @@ - + @@ -8521,9 +8521,9 @@ - - + + @@ -9021,9 +9021,9 @@ - - + + @@ -12054,7 +12054,7 @@ - + @@ -12554,7 +12554,7 @@ - + @@ -13054,7 +13054,7 @@ - + @@ -13554,7 +13554,7 @@ - + @@ -14026,7 +14026,6 @@ - @@ -14055,6 +14054,7 @@ + @@ -14554,7 +14554,7 @@ - + @@ -15054,7 +15054,7 @@ - + @@ -15554,7 +15554,7 @@ - + @@ -16054,7 +16054,7 @@ - + @@ -16554,7 +16554,7 @@ - + @@ -17054,7 +17054,7 @@ - + @@ -17554,7 +17554,7 @@ - + @@ -18054,7 +18054,7 @@ - + @@ -18554,7 +18554,7 @@ - + @@ -19026,7 +19026,6 @@ - @@ -19055,6 +19054,7 @@ + diff --git a/android/assets/menu/Settings.png b/android/assets/menu/Settings.png deleted file mode 100644 index 5ff5af2..0000000 Binary files a/android/assets/menu/Settings.png and /dev/null differ diff --git a/android/assets/skins/menupack.atlas b/android/assets/skins/menupack.atlas new file mode 100644 index 0000000..57c016e --- /dev/null +++ b/android/assets/skins/menupack.atlas @@ -0,0 +1,33 @@ + +menupack.png +format: RGBA8888 +filter: Nearest,Nearest +repeat: none +blau + rotate: false + xy: 1, 1 + size: 128, 128 + orig: 128, 128 + offset: 0, 0 + index: -1 +gelb + rotate: false + xy: 131, 1 + size: 128, 128 + orig: 128, 128 + offset: 0, 0 + index: -1 +grün + rotate: false + xy: 261, 1 + size: 128, 128 + orig: 128, 128 + offset: 0, 0 + index: -1 +rot + rotate: false + xy: 391, 1 + size: 128, 128 + orig: 128, 128 + offset: 0, 0 + index: -1 diff --git a/android/assets/skins/menupack.json b/android/assets/skins/menupack.json new file mode 100644 index 0000000..82ae54a --- /dev/null +++ b/android/assets/skins/menupack.json @@ -0,0 +1,20 @@ +{ + "com.badlogic.gdx.graphics.g2d.BitmapFont": { + "font": { "file": "fonts/font.fnt" }, + }, + "com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": { + "default": { "up": "blau" , "down": "blau", "font": font, "pressedOffsetY": -4 } + }, + "com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": { + "default": { "up": "grün" , "down": "grün", "font": font, "pressedOffsetY": -4 } + }, + "com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": { + "default": { "up": "gelb" , "down": "gelb", "font": font, "pressedOffsetY": -4 } + }, + "com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": { + "default": { "up": "rot" , "down": "rot", "font": font, "pressedOffsetY": -4 } + }, + "com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle": { + "default": { "font": font} + } +} \ No newline at end of file diff --git a/android/assets/skins/menupack.pack b/android/assets/skins/menupack.pack new file mode 100644 index 0000000..57c016e --- /dev/null +++ b/android/assets/skins/menupack.pack @@ -0,0 +1,33 @@ + +menupack.png +format: RGBA8888 +filter: Nearest,Nearest +repeat: none +blau + rotate: false + xy: 1, 1 + size: 128, 128 + orig: 128, 128 + offset: 0, 0 + index: -1 +gelb + rotate: false + xy: 131, 1 + size: 128, 128 + orig: 128, 128 + offset: 0, 0 + index: -1 +grün + rotate: false + xy: 261, 1 + size: 128, 128 + orig: 128, 128 + offset: 0, 0 + index: -1 +rot + rotate: false + xy: 391, 1 + size: 128, 128 + orig: 128, 128 + offset: 0, 0 + index: -1 diff --git a/android/assets/skins/menupack.png b/android/assets/skins/menupack.png new file mode 100644 index 0000000..353ec83 Binary files /dev/null and b/android/assets/skins/menupack.png differ diff --git a/build.gradle b/build.gradle index 7a52a70..ceffee3 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.1' + classpath 'com.android.tools.build:gradle:2.3.3' classpath 'org.robovm:robovm-gradle-plugin:1.9.0' } } diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/ControllingType.java b/core/src/de/samdev/colorrunner/game/world/entities/gameentities/ControllingType.java index 6a76797..d21b4be 100644 --- a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/ControllingType.java +++ b/core/src/de/samdev/colorrunner/game/world/entities/gameentities/ControllingType.java @@ -5,5 +5,5 @@ package de.samdev.colorrunner.game.world.entities.gameentities; */ public enum ControllingType { - RUNBOTTOM, RUNTOP, FLY, NOTHING + RUNBOTTOM, RUNTOP, FLY, NOTHING, GRAVITY } diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/PlayerEntity.java b/core/src/de/samdev/colorrunner/game/world/entities/gameentities/PlayerEntity.java index 1ad81d0..cb0490f 100644 --- a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/PlayerEntity.java +++ b/core/src/de/samdev/colorrunner/game/world/entities/gameentities/PlayerEntity.java @@ -9,6 +9,7 @@ import de.samdev.colorrunner.game.world.SwipeDirection; import de.samdev.colorrunner.game.world.entities.CRGameEntity; import de.samdev.colorrunner.game.world.entities.MovingEntity; import de.samdev.colorrunner.game.world.entities.gameentities.controller.AbstractPlayerController; +import de.samdev.colorrunner.game.world.entities.gameentities.controller.GravityPlayerController; import de.samdev.colorrunner.game.world.entities.gameentities.controller.RunBottomPlayerController; import de.samdev.colorrunner.game.world.entities.gameentities.controller.FlyPlayerController; import de.samdev.colorrunner.game.world.entities.gameentities.controller.RunTopPlayerController; @@ -52,6 +53,9 @@ public class PlayerEntity extends MovingEntity { case FLY: if (controller.getControllerType() != ControllingType.FLY) controller = new FlyPlayerController(this); break; + case GRAVITY: + if (controller.getControllerType() != ControllingType.GRAVITY) controller = new GravityPlayerController(this); + break; } controller.update(delta); diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/GravityPlayerController.java b/core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/GravityPlayerController.java index 3fb47a0..86d8289 100644 --- a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/GravityPlayerController.java +++ b/core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/GravityPlayerController.java @@ -1,8 +1,45 @@ package de.samdev.colorrunner.game.world.entities.gameentities.controller; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input; + +import de.samdev.colorrunner.game.world.entities.gameentities.ControllingType; +import de.samdev.colorrunner.game.world.entities.gameentities.PlayerEntity; + /** * Created by benza on 25.05.2017. */ -public class GravityPlayerController { +public class GravityPlayerController extends AbstractPlayerController{ + public GravityPlayerController(PlayerEntity e) + { + super(e); + } + + @Override + public void update(float delta) { + boolean down = Gdx.input.isKeyPressed(Input.Keys.SPACE) || Gdx.input.isTouched(); + + Player.velocity.y -= GRAVITY_FORCE * delta; + + if (Player.velocity.y < -TERMINAL_VELOCITY) { + Player.velocity.y = -TERMINAL_VELOCITY; + } + + if (Player.isTouching_BOTTOM() && Player.velocity.y < 0) + Player.velocity.y = 0; + } + + @Override + public ControllingType getControllerType() { + return ControllingType.GRAVITY; + } + + @Override + public void jumpPressed() { + if(Player.isTouching_BOTTOM() || Player.isTouching_TOP()) + { + GRAVITY_FORCE = GRAVITY_FORCE * -1; + } + } } diff --git a/core/src/de/samdev/colorrunner/game/world/map/CRTiledMap.java b/core/src/de/samdev/colorrunner/game/world/map/CRTiledMap.java index 0b5b9ae..9642755 100644 --- a/core/src/de/samdev/colorrunner/game/world/map/CRTiledMap.java +++ b/core/src/de/samdev/colorrunner/game/world/map/CRTiledMap.java @@ -25,6 +25,8 @@ public class CRTiledMap { public final static int GID_INTER_UP = 16; public final static int GID_INTER_DOWN = 17; public final static int GID_INTER_RIGHT = 18; + public final static int GID_INTER_MID = 19; + public final static int GID_INTER_END = 20; public int width; public int height; @@ -109,6 +111,9 @@ public class CRTiledMap { case CRTiledMap.GID_EMPTY_2: return null; + case CRTiledMap.GID_MID: + return new NoStateFloorTileEntity(world, px, py); + case CRTiledMap.GID_UP: return new UpStateFloorTileEntity(world, px, py); @@ -121,9 +126,6 @@ public class CRTiledMap { case CRTiledMap.GID_LEFT: return new LeftStateFloorTileEntity(world, px, py); - case CRTiledMap.GID_MID: - return new NoStateFloorTileEntity(world, px, py); - default: Gdx.app.error("MapLoad", "Unknown GID: " + id); return null; diff --git a/core/src/de/samdev/colorrunner/game/world/map/provider/EndlessMapProvider.java b/core/src/de/samdev/colorrunner/game/world/map/provider/EndlessMapProvider.java index e7e8a15..6bfc94e 100644 --- a/core/src/de/samdev/colorrunner/game/world/map/provider/EndlessMapProvider.java +++ b/core/src/de/samdev/colorrunner/game/world/map/provider/EndlessMapProvider.java @@ -2,7 +2,6 @@ package de.samdev.colorrunner.game.world.map.provider; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.math.Rectangle; -import com.badlogic.gdx.math.Vector2; import java.util.ArrayList; import java.util.List; @@ -55,6 +54,10 @@ public class EndlessMapProvider extends MapProvider { return TriggerType.RUNTOP; else if( sections.get(i).crTiledMap.interaktionen[x - start][y] == CRTiledMap.GID_INTER_RIGHT) return TriggerType.FLY; + else if( sections.get(i).crTiledMap.interaktionen[x - start][y] == CRTiledMap.GID_INTER_MID) + return TriggerType.GRAVITY; + else if( sections.get(i).crTiledMap.interaktionen[x - start][y] == CRTiledMap.GID_INTER_END) + return TriggerType.END; else if(sections.get(i).crTiledMap.interaktionen[x - start][y] == 0) return TriggerType.NOTHING; else { diff --git a/core/src/de/samdev/colorrunner/game/world/map/provider/StaticMapProvider.java b/core/src/de/samdev/colorrunner/game/world/map/provider/StaticMapProvider.java index 2ee1a01..32b4aa8 100644 --- a/core/src/de/samdev/colorrunner/game/world/map/provider/StaticMapProvider.java +++ b/core/src/de/samdev/colorrunner/game/world/map/provider/StaticMapProvider.java @@ -42,6 +42,10 @@ public class StaticMapProvider extends MapProvider { return TriggerType.RUNBOTTOM; else if(map.interaktionen[x][y] == CRTiledMap.GID_INTER_RIGHT) return TriggerType.FLY; + else if(map.interaktionen[x][y] == CRTiledMap.GID_INTER_MID) + return TriggerType.GRAVITY; + else if(map.interaktionen[x][y] == CRTiledMap.GID_INTER_END) + return TriggerType.END; else if(map.interaktionen[x][y] == 0) return TriggerType.NOTHING; else diff --git a/core/src/de/samdev/colorrunner/game/world/map/provider/TriggerType.java b/core/src/de/samdev/colorrunner/game/world/map/provider/TriggerType.java index 54fd255..93a69a8 100644 --- a/core/src/de/samdev/colorrunner/game/world/map/provider/TriggerType.java +++ b/core/src/de/samdev/colorrunner/game/world/map/provider/TriggerType.java @@ -2,5 +2,5 @@ package de.samdev.colorrunner.game.world.map.provider; public enum TriggerType { - RUNBOTTOM, RUNTOP, FLY, NOTHING + RUNBOTTOM, RUNTOP, FLY, NOTHING, GRAVITY, END } \ No newline at end of file diff --git a/core/src/de/samdev/colorrunner/screens/menu/MainMenu.java b/core/src/de/samdev/colorrunner/screens/menu/MainMenu.java index 8631c76..82503d8 100644 --- a/core/src/de/samdev/colorrunner/screens/menu/MainMenu.java +++ b/core/src/de/samdev/colorrunner/screens/menu/MainMenu.java @@ -9,22 +9,17 @@ import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureAtlas; -import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.Stage; -import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; -import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import de.samdev.colorrunner.CRGame; import de.samdev.colorrunner.game.world.map.CRMapStorage; -import de.samdev.colorrunner.game.world.map.provider.EndlessMapProvider; import de.samdev.colorrunner.game.world.map.provider.StaticMapProvider; - import de.samdev.colorrunner.screens.gameScreen.GameScreen; public class MainMenu implements Screen { @@ -45,10 +40,7 @@ public class MainMenu implements Screen { private TextButton buttonOption = new TextButton("Option", skin); private TextButton buttonExit = new TextButton("Exit", skin); - private Texture myTexture = new Texture(Gdx.files.internal("menu/Settings.png")); - private TextureRegion myTextureRegion= new TextureRegion(myTexture); - private TextureRegionDrawable myTexRegionDrawable = new TextureRegionDrawable(myTextureRegion); - private ImageButton optionButton = new ImageButton(myTexRegionDrawable); + // folgendes mal als Beispiel :) /* @@ -141,16 +133,15 @@ button3.addListener(new InputListener(){ Gdx.app.exit(); } }); - - table.add(title).padBottom(40).row(); - table.add(buttonPlay1).size((int)((double)Gdx.graphics.getWidth() / 2.0D),80).padBottom(20).row(); - table.add(buttonPlay2).size((int)((double)Gdx.graphics.getWidth() / 2.0D),80).padBottom(20).row(); - table.add(buttonOption).size((int)((double)Gdx.graphics.getWidth() / 2.0D),80).padBottom(20).row(); - table.add(buttonExit).size((int)((double)Gdx.graphics.getWidth() / 2.0D),80).padBottom(20).row(); + + table.add(buttonPlay1).size((int)((double)Gdx.graphics.getWidth() / 2.0D),250); + table.add(buttonPlay2).size((int)((double)Gdx.graphics.getWidth() / 2.0D),250).row(); + table.add(title).expand().row(); + table.add(buttonOption).size((int)((double)Gdx.graphics.getWidth() / 2.0D),250); + table.add(buttonExit).size((int)((double)Gdx.graphics.getWidth() / 2.0D),250); table.setFillParent(true); stage.addActor(table); - stage.addActor(optionButton); Gdx.input.setInputProcessor(stage); } diff --git a/data/Tileset.pdn b/data/Tileset.pdn index bbc5ecd..1b2b6e5 100644 Binary files a/data/Tileset.pdn and b/data/Tileset.pdn differ diff --git a/data/Tileset.png b/data/Tileset.png index 7e75f37..cde291b 100644 Binary files a/data/Tileset.png and b/data/Tileset.png differ