Skip to content

Commit

Permalink
fix broken sound playing
Browse files Browse the repository at this point in the history
  • Loading branch information
x8c8r committed Jun 25, 2024
1 parent 71b93d9 commit eb2cb61
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ class PlayState extends MusicBeatState

override public function create()
{

theFunne = FlxG.save.data.newInput;
if (FlxG.sound.music != null)
FlxG.sound.music.stop();
Expand Down Expand Up @@ -228,6 +227,15 @@ class PlayState extends MusicBeatState
if (SONG == null)
SONG = Song.loadFromJson('tutorial');

// Unlock songs when you play them, aint fucking no one beating unfairness j after other 3 songs
if (FlxG.save.data.beatSongs != null) {
if (!FlxG.save.data.beatSongs.contains(curSong.toLowerCase))
FlxG.save.data.beatSongs.push(curSong.toLowerCase());
#if debug
trace(curSong.toLowerCase());
#end
}

Conductor.mapBPMChanges(SONG);
Conductor.changeBPM(SONG.bpm);

Expand Down Expand Up @@ -1108,11 +1116,15 @@ class PlayState extends MusicBeatState
previousFrameTime = FlxG.game.ticks;
lastReportedPlayheadPosition = 0;

if (!paused)
FlxG.sound.playMusic(Paths.inst(PlayState.SONG.song), 1, false);
FlxG.sound.music.onComplete = endSong;
FlxG.sound.playMusic(Paths.inst(PlayState.SONG.song), 1, false);
vocals.play();

if (paused) {
FlxG.sound.music.pause();
vocals.pause();
}
FlxG.sound.music.onComplete = endSong;

#if desktop
// Song duration in a float, useful for the time left feature
songLength = FlxG.sound.music.length;
Expand Down Expand Up @@ -1932,14 +1944,6 @@ class PlayState extends MusicBeatState

persistentUpdate = false;
persistentDraw = true;

if (FlxG.save.data.beatSongs != null) {
if (!FlxG.save.data.beatSongs.contains(curSong.toLowerCase))
FlxG.save.data.beatSongs.push(curSong.toLowerCase());
#if debug
trace(curSong.toLowerCase());
#end
}


var sub:FlxSubState = new ResultsSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y, results, this);
Expand Down

0 comments on commit eb2cb61

Please sign in to comment.