alle tiles werden angezeigt; Ende eingefügt und flappy Mode eingefügt, beides funktioniert noch nicht ganz

This commit is contained in:
Armin Benz 2017-08-02 21:26:58 +02:00
parent dffc312bcb
commit 3bafdafc2e
17 changed files with 184 additions and 57 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="500" height="20" tilewidth="16" tileheight="16" nextobjectid="1">
<tileset firstgid="1" name="Tileset" tilewidth="16" tileheight="16" tilecount="100">
<tileset firstgid="1" name="Tileset" tilewidth="16" tileheight="16" tilecount="100" columns="10">
<image source="../../../data/Tileset.png" width="160" height="160"/>
</tileset>
<layer name="Kachelebene" width="500" height="20">
@ -3521,9 +3521,9 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="23"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -4021,9 +4021,9 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -4523,7 +4523,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -5023,7 +5023,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -5523,7 +5523,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -6023,7 +6023,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -6523,7 +6523,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -7023,7 +7023,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -7523,7 +7523,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -8023,7 +8023,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -8521,9 +8521,9 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -9021,9 +9021,9 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="23"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -12054,7 +12054,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -12554,7 +12554,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -13054,7 +13054,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -13554,7 +13554,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -14026,7 +14026,6 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="17"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -14055,6 +14054,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -14554,7 +14554,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -15054,7 +15054,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -15554,7 +15554,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -16054,7 +16054,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -16554,7 +16554,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -17054,7 +17054,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -17554,7 +17554,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -18054,7 +18054,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -18554,7 +18554,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -19026,7 +19026,6 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="16"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
@ -19055,6 +19054,7 @@
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="20"/>
<tile gid="0"/>
<tile gid="0"/>
<tile gid="0"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -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

View File

@ -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}
}
}

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -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'
}
}

View File

@ -5,5 +5,5 @@ package de.samdev.colorrunner.game.world.entities.gameentities;
*/
public enum ControllingType {
RUNBOTTOM, RUNTOP, FLY, NOTHING
RUNBOTTOM, RUNTOP, FLY, NOTHING, GRAVITY
}

View File

@ -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);

View File

@ -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;
}
}
}

View File

@ -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;

View File

@ -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 {

View File

@ -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

View File

@ -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
}

View File

@ -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);
}

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB