-
Notifications
You must be signed in to change notification settings - Fork 1
Playing, changing and stopping music
The LibGDX standard for playing music, AssetManager.getAsset(name, Music.class).play()
won't account for the user-specified volume and mute settings from UserSettings
. To fix this, the ResourceService
has been extended to add new music functionality that accounts for this, thus allowing calling classes to not worry about the user settings and prevent code repetition.
Use the following method from the ResourceService
:
public @Null Music playMusic(String musicName, boolean loop)
This method will play the music with the given path, assuming it wasn't playing already. The following will be handled for you:
- Any previously playing music will be stopped
- The
Music
asset will be fetched from theAssetManager
and returned if you want to dispose of it later. - User-set volume and mute settings will be accounted for.
To stop music, use:
public void stopCurrentMusic()
Calls to the above functions will keep track of which music file is playing, so a call to stopCurrentMusic()
will stop the currently-playing music.
The MusicType
enum in the MainGameArea
stores music types used in-game:
public enum MusicType {
NORMAL("bgm_new.wav"), BOSS("boss_room_music.mp3");
...
}
To add or change music files, simply change these path names or add new enum values. Then call MainGameArea.playMusic(MusicType musicType)
.
Be sure to reference your asset source in assets/sounds/music/music_citations.txt
.
Design Choices
Utilities
Animals
Menus/screens
Character
- Character Animations
- Character's Inventory On Display
- Character's Inventory System
- Character's HealthBar
- Character's Interaction with Items
- Character achievements
- Saving Character
- Player-(and-other-NPC)-invincibility-frames
- Player Factory
- Scoring System
- Test Plan for Inventory System
- Test Plan for Player's Interaction with Items
- Test Plan for Player's Inventory Display
- Test Plan for Saving Character State
- Test Plan for Scoring System
Map
Weapon
- Weapon Overview
- Weapon Types
- Weapon Structure
- Weapon Stats Display
- Testing Plan for Weapon Factory
- Testing Plan for Firing Controller Component
- Testing Plan for Position Tracker Component
- Testing Plan for Weapon Animation Controller component
- Testing Plan for Concrete Melee Weapon class
- Testing Plan for Concrete Ranged Weapon class