Skip to content

Commit ffb2b1e

Browse files
committed
Pause music and game over music
and bump the version number
1 parent d533549 commit ffb2b1e

File tree

4 files changed

+37
-6
lines changed

4 files changed

+37
-6
lines changed

source/GameOverSubstate.hx

+17-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ class GameOverSubstate extends MusicBeatSubstate
1616

1717
var stageSuffix:String = "";
1818

19+
public var gameOverMusicName:String = "gameOver";
20+
public var gameOverMusicEndName:String = "gameOverEnd";
21+
1922
public function new(x:Float, y:Float)
2023
{
2124
var daStage = PlayState.curStage;
@@ -38,6 +41,18 @@ class GameOverSubstate extends MusicBeatSubstate
3841
} else {
3942
deathSound += stageSuffix;
4043
}
44+
gameOverMusicName += stageSuffix;
45+
gameOverMusicEndName += stageSuffix;
46+
if (Std.isOfType(FlxG.state, PlayState)) {
47+
var thingy:PlayState = cast FlxG.state;
48+
if (thingy.currentUIStyle.gameOverMusic != null) {
49+
gameOverMusicName = thingy.currentUIStyle.gameOverMusic;
50+
}
51+
if (thingy.currentUIStyle.gameOverMusic != null) {
52+
gameOverMusicEndName = thingy.currentUIStyle.gameOverMusicEnd;
53+
}
54+
}
55+
4156

4257
super();
4358

@@ -98,7 +113,7 @@ class GameOverSubstate extends MusicBeatSubstate
98113
FlxG.camera.follow(camFollow, LOCKON, 0.01);
99114

100115
if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.finished)
101-
CoolUtil.playMusic('gameOver' + stageSuffix);
116+
CoolUtil.playMusic(gameOverMusicName);
102117

103118
if (FlxG.sound.music.playing)
104119
Conductor.songPosition = FlxG.sound.music.time;
@@ -120,7 +135,7 @@ class GameOverSubstate extends MusicBeatSubstate
120135
isEnding = true;
121136
bf.playAnim('deathConfirm', true);
122137
FlxG.sound.music.stop();
123-
FlxG.sound.play(Paths.music('gameOverEnd' + stageSuffix));
138+
FlxG.sound.play(Paths.music(gameOverMusicEndName));
124139
new FlxTimer().start(0.7, function(tmr:FlxTimer)
125140
{
126141
FlxG.camera.fade(FlxColor.BLACK, 2, false, gotoplaystate);

source/Main.hx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Sys;
1818

1919
class Main extends Sprite
2020
{
21-
public static final gameVersionStr = "v1.0.0 First Release";
21+
public static final gameVersionStr = "v1.0.1 Funny Day 0 Patch";
2222

2323
var gameWidth:Int = 1280; // Width of the game in pixels (might be less / more in actual pixels depending on your zoom).
2424
var gameHeight:Int = 720; // Height of the game in pixels (might be less / more in actual pixels depending on your zoom).

source/Note.hx

+11-2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ class SwagUIStyleFile { //Because Float->Float doesnt work with the JsonParser
105105
public var iconEaseStr:Null<String>;
106106
public var iconEase:Null<Float>;
107107
public var font:Null<String>;
108+
public var gameOverMusic:Null<String>;
109+
public var gameOverMusicEnd:Null<String>;
110+
public var pauseMusic:Null<String>;
108111

109112
public function new() {
110113
return;
@@ -133,7 +136,11 @@ class SwagUIStyle {
133136
public var hudThingPos:Null<Map<String, Array<Float>>>;
134137
public var iconEase:Null<Float>;
135138
public var iconEaseFunc:Null<Float->Float>;
136-
public var font:String = "vcr font";
139+
public var font:String = "vcr font"; //todo: is this implemented?
140+
//todo: implement these
141+
public var gameOverMusic:Null<String>;
142+
public var gameOverMusicEnd:Null<String>;
143+
public var pauseMusic:Null<String>;
137144

138145
public function new() {
139146
return;
@@ -222,7 +229,9 @@ class SwagUIStyle {
222229
}
223230
uiStyle.font = uiStyleFile.font == null ? "vcr font" : uiStyleFile.font;
224231
uiStyle.hudThingPos = uiStyleFile.hudThingPos == null ? new Map<String, Array<Float>>() : uiStyleFile.hudThingPos;
225-
232+
uiStyle.gameOverMusic = uiStyleFile.gameOverMusic;
233+
uiStyle.gameOverMusicEnd = uiStyleFile.gameOverMusicEnd;
234+
uiStyle.pauseMusic = uiStyleFile.pauseMusic;
226235
Note.loadedUIStyles.set('${modName}:${name}', uiStyle);
227236
trace('loaded uistyle ${modName}:${name}');
228237
return uiStyle;

source/PauseSubState.hx

+8-1
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,16 @@ class PauseSubState extends MusicBeatSubstate
3030
if (Std.isOfType(FlxG.state, PlayStateOffsetCalibrate)) {
3131
menuItems.remove("Exit to menu");
3232
}
33+
var pauseMusicName = 'breakfast';
34+
if (Std.isOfType(FlxG.state, PlayState)) {
35+
var thingy:PlayState = cast FlxG.state;
36+
if (thingy.currentUIStyle.pauseMusic != null) {
37+
pauseMusicName = thingy.currentUIStyle.pauseMusic;
38+
}
39+
}
3340

3441
//Dont use CoolUtil.playMusic here
35-
pauseMusic = new FlxSound().loadEmbedded(Paths.music('breakfast'), true, true);
42+
pauseMusic = new FlxSound().loadEmbedded(Paths.music(pauseMusicName), true, true);
3643
pauseMusic.volume = 0;
3744
pauseMusic.play(false, FlxG.random.int(0, Std.int(pauseMusic.length / 2)));
3845

0 commit comments

Comments
 (0)