Various
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:
parent
481f51dc2b
commit
cd0296ca0a
3 changed files with 12 additions and 6 deletions
|
@ -1,17 +1,19 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<tileset firstgid="1" name="platformSet" tilewidth="64" tileheight="64" tilecount="3" columns="3">
|
||||||
<image source="../spritesheets/platformSet.png" width="192" height="64"/>
|
<image source="../spritesheets/platformSet.png" width="192" height="64"/>
|
||||||
</tileset>
|
</tileset>
|
||||||
<layer name="PLATFORM" width="50" height="8">
|
<layer name="PLATFORM" width="50" height="8">
|
||||||
<data encoding="base64" compression="zlib">
|
<data encoding="base64" compression="zlib">
|
||||||
eJxjYBgFo2B4ACY62MGIhAmpo5Z91ABMaBgZMEMxslpS3IXNvMEMBrv7hhIAAE/AACE=
|
eJxjYBgFo2B4ACYK9TMSqQaGKTWLGEANc5iwYGTADMXI6klxFzbzyAWU6B1oOyhNf0MRAABepAAp
|
||||||
</data>
|
</data>
|
||||||
</layer>
|
</layer>
|
||||||
<objectgroup name="BOUNDARY">
|
|
||||||
<object id="17" x="-64" y="-192" width="3328" height="896"/>
|
|
||||||
</objectgroup>
|
|
||||||
<objectgroup name="PLAYER">
|
<objectgroup name="PLAYER">
|
||||||
<object id="19" gid="3" x="64" y="320" width="64" height="64"/>
|
<object id="19" gid="3" x="64" y="320" width="64" height="64"/>
|
||||||
</objectgroup>
|
</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>
|
</map>
|
||||||
|
|
BIN
core/assets/sounds/jumping.mp3
Normal file
BIN
core/assets/sounds/jumping.mp3
Normal file
Binary file not shown.
|
@ -3,6 +3,7 @@ package com.game.States;
|
||||||
import static com.game.Misc.Vars.PPM;
|
import static com.game.Misc.Vars.PPM;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Input;
|
import com.badlogic.gdx.Input;
|
||||||
|
import com.badlogic.gdx.audio.Sound;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
import com.badlogic.gdx.maps.tiled.TiledMap;
|
import com.badlogic.gdx.maps.tiled.TiledMap;
|
||||||
|
@ -41,6 +42,8 @@ public class Play extends State {
|
||||||
|
|
||||||
ArrayList<Platform> platforms = new ArrayList<Platform>();
|
ArrayList<Platform> platforms = new ArrayList<Platform>();
|
||||||
|
|
||||||
|
private Sound jumpSound = Gdx.audio.newSound(Gdx.files.internal("sounds/jumping.mp3"));
|
||||||
|
|
||||||
public Play(StateManager sm) {
|
public Play(StateManager sm) {
|
||||||
super(sm);
|
super(sm);
|
||||||
world = new World(new Vector2(0, Vars.GRAVITY.y), true);
|
world = new World(new Vector2(0, Vars.GRAVITY.y), true);
|
||||||
|
@ -110,6 +113,7 @@ public class Play extends State {
|
||||||
public void handleInput() {
|
public void handleInput() {
|
||||||
if(Gdx.input.isKeyPressed(Input.Keys.SPACE))
|
if(Gdx.input.isKeyPressed(Input.Keys.SPACE))
|
||||||
{
|
{
|
||||||
|
jumpSound.play();
|
||||||
player.jump();
|
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);
|
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);
|
tmr = new OrthogonalTiledMapRenderer(tileMap);
|
||||||
|
|
||||||
TiledMapTileLayer layer = (TiledMapTileLayer)tileMap.getLayers().get("PLATFORM");
|
TiledMapTileLayer layer = (TiledMapTileLayer)tileMap.getLayers().get("PLATFORM");
|
||||||
|
|
Reference in a new issue