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
|
@ -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");
|
||||
|
|
Reference in a new issue