Skip to content

Commit

Permalink
Fixed Sound and Music
Browse files Browse the repository at this point in the history
  • Loading branch information
PomeloBranco committed May 20, 2023
1 parent b556e79 commit 08880c8
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion assets/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,8 @@
"collect": "sounds/collect.wav",
"level-passed": "sounds/level-passed.wav",
"level-fail": "sounds/level-fail.wav",
"whip": "sounds/whip2.wav",
"whip": "sounds/normal_hit.wav",
"whip2": "sounds/heavy_hit.wav",
"alerted": "sounds/alerted.wav",
"dash": "sounds/dash.wav",
"walking-on-grass": "sounds/walking_on_grass-02.wav",
Expand Down
Binary file modified assets/screens/loading-screen/loading-animation-sheet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sounds/heavy_hit.wav
Binary file not shown.
Binary file added assets/sounds/normal_hit.wav
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public class PlayerController {
* Sound for player attacking
*/
private Sound attack_sound;
/**
* Sound for player heaby attacking
*/
private Sound attack_heavy_sound;

/**
* Sound for player dashing
Expand Down Expand Up @@ -173,6 +177,10 @@ public Sound getAttackSound() {
return attack_sound;
}

public Sound getHeavyAttackSound(){
return attack_heavy_sound;
}

public GameSetting getSetting() {return setting;}


Expand All @@ -186,6 +194,7 @@ public PlayerController(LevelContainer levelContainer, GameSetting setting) {
this.board = levelContainer.getBoard();
collect_sound = levelContainer.getDirectory().getEntry("collect", Sound.class);
attack_sound = levelContainer.getDirectory().getEntry("whip", Sound.class);
attack_heavy_sound = levelContainer.getDirectory().getEntry("whip2", Sound.class);
dash_sound = levelContainer.getDirectory().getEntry("dash", Sound.class);
walk_sound = levelContainer.getDirectory().getEntry("walking-on-soil", Sound.class);
stateMachine = new DefaultStateMachine<>(this, PlayerState.IDLE);
Expand Down
2 changes: 1 addition & 1 deletion core/src/infinityx/lunarhaze/controllers/PlayerState.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void update(PlayerController entity) {
@Override
public void enter(PlayerController entity) {
if(entity.getSetting().isSoundEnabled()) {
entity.getAttackSound().play(entity.getSetting().getSoundVolume());
entity.getHeavyAttackSound().play(entity.getSetting().getSoundVolume());
}
setTexture(entity, "heavyattack");
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/infinityx/lunarhaze/screens/LoadingMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ public void render(float delta) {
* Split the sprite sheet and generate animation frames
*/
public void create() {
TextureRegion[][] moonTextures = TextureRegion.split(moonphase, moonphase.getWidth() / 35,
moonphase.getHeight() / 1);
TextureRegion[][] moonTextures = TextureRegion.split(moonphase, (int) (moonphase.getWidth() / 35.0f),
moonphase.getHeight());
TextureRegion[] moonFrames = new TextureRegion[35 * 1];
int index = 0;
for (int i = 0; i < 1; i++) {
Expand Down

0 comments on commit 08880c8

Please sign in to comment.