From dcb69d2a612064dc41f5efc28bb6dcf1d616422e Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 17 Nov 2020 16:22:29 -0800 Subject: [PATCH] freeplay sounds --- CHANGELOG.md | 3 +++ source/ChartingState.hx | 7 +++++-- source/FreeplayState.hx | 23 +++++++++++++++++------ source/TitleState.hx | 2 +- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54627367c..017b82294 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Music playing on the freeplay menu. +- UI sounds on freeplay menu ### Changed - Moved all the intro texts to its own txt file instead of being hardcoded, this allows for much easier customization. File is in the data folder, called "introText.txt", follow the format in there and you're probably good to go! ### Fixed diff --git a/source/ChartingState.hx b/source/ChartingState.hx index 1dd6eb0b6..08e16730e 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -391,7 +391,7 @@ class ChartingState extends MusicBeatState if (curBeat % 4 == 0) { - if (curStep > lengthBpmBullshit() * (curSection + 1)) + if (curStep > 16 * (curSection + 1)) { trace(curStep); trace((_song.notes[curSection].lengthInSteps) * (curSection + 1)); @@ -406,6 +406,9 @@ class ChartingState extends MusicBeatState } } + FlxG.watch.addQuick('daBeat', curBeat); + FlxG.watch.addQuick('daStep', curStep); + if (FlxG.mouse.justPressed) { if (FlxG.mouse.overlaps(curRenderedNotes)) @@ -699,7 +702,7 @@ class ChartingState extends MusicBeatState private function addNote():Void { - var noteStrum = getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * lengthBpmBullshit())); + var noteStrum = getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16)); var noteData = Math.floor(FlxG.mouse.x / GRID_SIZE); var noteSus = 0; diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 5002fff57..f3bfe4b7d 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -24,14 +24,17 @@ class FreeplayState extends MusicBeatState var intendedScore:Int = 0; private var grpSongs:FlxTypedGroup; + private var curPlaying:Bool = false; override function create() { - if (FlxG.sound.music != null) - { - if (!FlxG.sound.music.playing) - FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt); - } + /* + if (FlxG.sound.music != null) + { + if (!FlxG.sound.music.playing) + FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt); + } + */ var isDebug:Bool = false; @@ -118,6 +121,11 @@ class FreeplayState extends MusicBeatState { super.update(elapsed); + if (FlxG.sound.music.volume < 0.7) + { + FlxG.sound.music.volume += 0.5 * FlxG.elapsed; + } + lerpScore = Math.floor(FlxMath.lerp(lerpScore, intendedScore, 0.4)); if (Math.abs(lerpScore - intendedScore) <= 10) @@ -187,7 +195,8 @@ class FreeplayState extends MusicBeatState function changeSelection(change:Int = 0) { - NGio.logEvent('Fresh'); + // NGio.logEvent('Fresh'); + FlxG.sound.play('assets/sounds/scrollMenu' + TitleState.soundExt, 0.4); curSelected += change; @@ -201,6 +210,8 @@ class FreeplayState extends MusicBeatState intendedScore = Highscore.getScore(songs[curSelected], curDifficulty); // lerpScore = 0; + FlxG.sound.playMusic('assets/music/' + songs[curSelected] + "_Inst" + TitleState.soundExt, 0); + var bullShit:Int = 0; for (item in grpSongs.members) diff --git a/source/TitleState.hx b/source/TitleState.hx index f2f1fff33..f93f061ec 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -68,7 +68,7 @@ class TitleState extends MusicBeatState } #if SKIP_TO_PLAYSTATE - FlxG.switchState(new ChartingState()); + FlxG.switchState(new FreeplayState()); #else startIntro(); #end