From d92af2b964a86d903b3c49ab18a74f1d8944ae67 Mon Sep 17 00:00:00 2001 From: Recrown Date: Fri, 11 Aug 2017 01:14:25 -0500 Subject: [PATCH] fixed minor issues in creative screen --- .../rhythmbullet/entity/enemies/Flake.java | 1 + .../rhythmbullet/entity/enemies/Pellet.java | 4 +--- .../rhythmbullet/ui/stages/GamePlayArea.java | 1 + .../ui/windows/MusicController.java | 18 +++++++++++------- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/core/src/zero1hd/rhythmbullet/entity/enemies/Flake.java b/core/src/zero1hd/rhythmbullet/entity/enemies/Flake.java index ca51db7..eb4f047 100755 --- a/core/src/zero1hd/rhythmbullet/entity/enemies/Flake.java +++ b/core/src/zero1hd/rhythmbullet/entity/enemies/Flake.java @@ -32,6 +32,7 @@ public class Flake extends Entity { shards[i].init(x, y, 360/shards.length*i, 0, 2); ec.getStage().addActor(shards[i]); } + this.speed = rate; this.timer = fuse; this.totalTime = fuse; diff --git a/core/src/zero1hd/rhythmbullet/entity/enemies/Pellet.java b/core/src/zero1hd/rhythmbullet/entity/enemies/Pellet.java index d70cfae..1875e86 100755 --- a/core/src/zero1hd/rhythmbullet/entity/enemies/Pellet.java +++ b/core/src/zero1hd/rhythmbullet/entity/enemies/Pellet.java @@ -44,9 +44,7 @@ public class Pellet extends Entity implements Poolable { @Override public void collided(Entity entity) { - if (entity.getClass() == PolyjetEntity.class) { - dead = true; - } + dead = true; super.collided(entity); } diff --git a/core/src/zero1hd/rhythmbullet/ui/stages/GamePlayArea.java b/core/src/zero1hd/rhythmbullet/ui/stages/GamePlayArea.java index 140d614..219c4c8 100755 --- a/core/src/zero1hd/rhythmbullet/ui/stages/GamePlayArea.java +++ b/core/src/zero1hd/rhythmbullet/ui/stages/GamePlayArea.java @@ -135,6 +135,7 @@ public class GamePlayArea extends Stage { if (currentSpawnInfo[i].getEntityCoordinator() != null) { entity.setCoordinator(currentSpawnInfo[i].getEntityCoordinator().buildCoordinator()); } + entity.init(currentSpawnInfo[i].parameters); addActor(entity); } diff --git a/core/src/zero1hd/rhythmbullet/ui/windows/MusicController.java b/core/src/zero1hd/rhythmbullet/ui/windows/MusicController.java index ade4385..61137b7 100755 --- a/core/src/zero1hd/rhythmbullet/ui/windows/MusicController.java +++ b/core/src/zero1hd/rhythmbullet/ui/windows/MusicController.java @@ -1,6 +1,8 @@ package zero1hd.rhythmbullet.ui.windows; import com.badlogic.gdx.Input.Keys; +import com.badlogic.gdx.audio.Music; +import com.badlogic.gdx.audio.Music.OnCompletionListener; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.InputEvent; @@ -15,7 +17,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import zero1hd.rhythmbullet.audio.AudioData; -public class MusicController extends Window { +public class MusicController extends Window implements OnCompletionListener { Skin skin; private Image togglePlay; private TextField info; @@ -57,12 +59,8 @@ public class MusicController extends Window { togglePlay.setDrawable(skin.getDrawable("arrow")); } else { - try { - togglePlay.setDrawable(skin.getDrawable("pause")); - audiofile.getPlaybackMusic().play(); - } catch (NullPointerException e) { - e.printStackTrace(); - } + togglePlay.setDrawable(skin.getDrawable("pause")); + audiofile.getPlaybackMusic().play(); } } super.clicked(event, x, y); @@ -129,4 +127,10 @@ public class MusicController extends Window { public AudioData getAudiofile() { return audiofile; } + + @Override + public void onCompletion(Music music) { + audiofile.dispose(); + audiofile = null; + } }