fixed constant dash sound bug + changed sword sound

This commit is contained in:
OfficialCHenry 2022-04-25 23:32:45 -04:00
parent 136ef0ca94
commit ade2e9581d
5 changed files with 13 additions and 5 deletions

Binary file not shown.

View File

@ -4,6 +4,7 @@ import InAir from "./InAir";
import InputWrapper from "../../Tools/InputWrapper"; import InputWrapper from "../../Tools/InputWrapper";
import PlayerState from "./PlayerState"; import PlayerState from "./PlayerState";
import { GameEventType } from "../../../Wolfie2D/Events/GameEventType"; import { GameEventType } from "../../../Wolfie2D/Events/GameEventType";
import { GameState } from "../../sword_enums";
export default class Fall extends InAir { export default class Fall extends InAir {
owner: AnimatedSprite; owner: AnimatedSprite;
@ -14,7 +15,9 @@ export default class Fall extends InAir {
update(deltaT: number): void { update(deltaT: number): void {
if (!PlayerState.dashTimer.isStopped()) { if (!PlayerState.dashTimer.isStopped()) {
this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "dash", loop: false, holdReference: false}); if(InputWrapper.getState() === GameState.GAMING){
this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "dash", loop: false, holdReference: false});
}
this.owner.animation.playIfNotAlready("DASH"); this.owner.animation.playIfNotAlready("DASH");
} }
else { else {

View File

@ -7,7 +7,7 @@ import InputWrapper from "../../Tools/InputWrapper";
import { PlayerStates } from "../PlayerController"; import { PlayerStates } from "../PlayerController";
import InAir from "./InAir"; import InAir from "./InAir";
import PlayerState from "./PlayerState"; import PlayerState from "./PlayerState";
import { GameState } from "../../sword_enums";
export default class Jump extends InAir { export default class Jump extends InAir {
owner: AnimatedSprite; owner: AnimatedSprite;
@ -19,7 +19,9 @@ export default class Jump extends InAir {
update(deltaT: number): void { update(deltaT: number): void {
if (!PlayerState.dashTimer.isStopped()) { if (!PlayerState.dashTimer.isStopped()) {
this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "dash", loop: false, holdReference: false}); if(InputWrapper.getState() === GameState.GAMING){
this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "dash", loop: false, holdReference: false});
}
this.owner.animation.playIfNotAlready("DASH"); this.owner.animation.playIfNotAlready("DASH");
} }
else { else {

View File

@ -5,6 +5,7 @@ import { PlayerStates } from "../PlayerController";
import OnGround from "./OnGround"; import OnGround from "./OnGround";
import PlayerState from "./PlayerState"; import PlayerState from "./PlayerState";
import { GameEventType } from "../../../Wolfie2D/Events/GameEventType"; import { GameEventType } from "../../../Wolfie2D/Events/GameEventType";
import { GameState } from "../../sword_enums";
export default class Walk extends OnGround { export default class Walk extends OnGround {
owner: AnimatedSprite; owner: AnimatedSprite;
@ -17,7 +18,9 @@ export default class Walk extends OnGround {
update(deltaT: number): void { update(deltaT: number): void {
if (!PlayerState.dashTimer.isStopped()) { if (!PlayerState.dashTimer.isStopped()) {
this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "dash", loop: false, holdReference: false}); if(InputWrapper.getState() === GameState.GAMING){
this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "dash", loop: false, holdReference: false});
}
this.owner.animation.playIfNotAlready("DASH"); this.owner.animation.playIfNotAlready("DASH");
} }
else { else {

View File

@ -163,7 +163,7 @@ export default class GameLevel extends Scene {
this.load.audio("level_up","shattered_sword_assets/sounds/level_up.wav"); this.load.audio("level_up","shattered_sword_assets/sounds/level_up.wav");
//神社じんじゃまつり by Second Dimension Imagination Group //神社じんじゃまつり by Second Dimension Imagination Group
this.load.audio("level_music","shattered_sword_assets/sounds/bgm1.mp3"); this.load.audio("level_music","shattered_sword_assets/sounds/bgm1.mp3");
this.load.audio("sword","shattered_sword_assets/sounds/sword_ding.m4a"); this.load.audio("sword","shattered_sword_assets/sounds/sword_ding1.m4a");