Added Level 2 and also added a jumping sound for when the player jumps.
Jumping sound comes out distorted but oh well.
This commit is contained in:
ESloman 2016-02-09 12:07:13 +00:00
parent 481f51dc2b
commit cd0296ca0a
3 changed files with 12 additions and 6 deletions

View file

@ -1,17 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="50" height="8" tilewidth="64" tileheight="64" nextobjectid="21">
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="50" height="8" tilewidth="64" tileheight="64" nextobjectid="22">
<tileset firstgid="1" name="platformSet" tilewidth="64" tileheight="64" tilecount="3" columns="3">
<image source="../spritesheets/platformSet.png" width="192" height="64"/>
</tileset>
<layer name="PLATFORM" width="50" height="8">
<data encoding="base64" compression="zlib">
eJxjYBgFo2B4ACY62MGIhAmpo5Z91ABMaBgZMEMxslpS3IXNvMEMBrv7hhIAAE/AACE=
eJxjYBgFo2B4ACYK9TMSqQaGKTWLGEANc5iwYGTADMXI6klxFzbzyAWU6B1oOyhNf0MRAABepAAp
</data>
</layer>
<objectgroup name="BOUNDARY">
<object id="17" x="-64" y="-192" width="3328" height="896"/>
</objectgroup>
<objectgroup name="PLAYER">
<object id="19" gid="3" x="64" y="320" width="64" height="64"/>
</objectgroup>
<objectgroup name="BOUNDARY">
<object id="21" x="-64" y="-192">
<polyline points="0,64 0,832 3392,832 3392,64 0,64"/>
</object>
</objectgroup>
</map>

Binary file not shown.

View file

@ -3,6 +3,7 @@ package com.game.States;
import static com.game.Misc.Vars.PPM;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.maps.tiled.TiledMap;
@ -41,6 +42,8 @@ public class Play extends State {
ArrayList<Platform> platforms = new ArrayList<Platform>();
private Sound jumpSound = Gdx.audio.newSound(Gdx.files.internal("sounds/jumping.mp3"));
public Play(StateManager sm) {
super(sm);
world = new World(new Vector2(0, Vars.GRAVITY.y), true);
@ -110,6 +113,7 @@ public class Play extends State {
public void handleInput() {
if(Gdx.input.isKeyPressed(Input.Keys.SPACE))
{
jumpSound.play();
player.jump();
}
@ -125,7 +129,7 @@ public class Play extends State {
{
player = new Player(world, new Vector2(500, 500), new Vector2(60, 60), Base.Colours.NONE);
tileMap = new TmxMapLoader().load("levels/level1.tmx");
tileMap = new TmxMapLoader().load("levels/level2.tmx");
tmr = new OrthogonalTiledMapRenderer(tileMap);
TiledMapTileLayer layer = (TiledMapTileLayer)tileMap.getLayers().get("PLATFORM");