-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add sounds! Bloop for picking key up and background music
- Fixed some issues in loading/handling of levels - Fixed level 10 not having a floor
- Loading branch information
1 parent
ce9bf10
commit a8c011f
Showing
10 changed files
with
134 additions
and
25 deletions.
There are no files selected for viewing
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
core/src/com/sgtcodfish/mobiusListing/systems/AudioSystem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package com.sgtcodfish.mobiusListing.systems; | ||
|
||
import java.util.ArrayList; | ||
|
||
import com.artemis.systems.VoidEntitySystem; | ||
import com.badlogic.gdx.Gdx; | ||
import com.badlogic.gdx.audio.Music; | ||
import com.badlogic.gdx.audio.Sound; | ||
import com.badlogic.gdx.utils.Disposable; | ||
|
||
/** | ||
* <p> | ||
* Handles playing all audio. | ||
* </p> | ||
* | ||
* @author Ashley Davis (SgtCoDFish) | ||
*/ | ||
public class AudioSystem extends VoidEntitySystem implements Disposable { | ||
public static final String AUDIO_PREFIX = "audio/"; | ||
|
||
private Music backgroundMusic = null; | ||
private Sound bloop = null; | ||
|
||
private ArrayList<MobiusSounds> soundQueue = null; | ||
|
||
public enum MobiusSounds { | ||
BLOOP; | ||
} | ||
|
||
public AudioSystem() { | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
soundQueue = new ArrayList<AudioSystem.MobiusSounds>(); | ||
|
||
backgroundMusic = Gdx.audio.newMusic(Gdx.files.internal(AUDIO_PREFIX + "soundtrack.mp3")); | ||
backgroundMusic.setLooping(true); | ||
backgroundMusic.setVolume(0.5f); | ||
|
||
bloop = Gdx.audio.newSound(Gdx.files.internal(AUDIO_PREFIX + "bloop.wav")); | ||
} | ||
|
||
@Override | ||
protected void processSystem() { | ||
if (soundQueue.size() > 0) { | ||
Gdx.app.debug("AUDIO_SYSTEM_PROCESS", "Processing " + soundQueue.size() + " queued sounds."); | ||
for (MobiusSounds sound : soundQueue) { | ||
switch (sound) { | ||
case BLOOP: { | ||
bloop.play(); | ||
break; | ||
} | ||
|
||
default: { | ||
Gdx.app.debug("AUDIO_SYSTEM_PROCESS", "Invalid sound in sound queue, size is " + soundQueue.size()); | ||
} | ||
} | ||
} | ||
|
||
soundQueue.clear(); | ||
} | ||
} | ||
|
||
public void start() { | ||
backgroundMusic.play(); | ||
} | ||
|
||
public void stop() { | ||
backgroundMusic.pause(); | ||
} | ||
|
||
public void enqueue(MobiusSounds sound) { | ||
soundQueue.add(sound); | ||
} | ||
|
||
public void dispose() { | ||
backgroundMusic.dispose(); | ||
bloop.dispose(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters