From 646694bb7986c90f8a53b11a16148b585d8341ab Mon Sep 17 00:00:00 2001 From: M&M Date: Mon, 8 Feb 2021 09:47:15 -0800 Subject: [PATCH 01/18] Resync by music instead of vocals --- source/PlayState.hx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index cc869e5de..72974df44 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2237,12 +2237,9 @@ class PlayState extends MusicBeatState override function stepHit() { - if (SONG.needsVoices) + if (FlxG.sound.music.time > Conductor.songPosition + 20 || FlxG.sound.music.time < Conductor.songPosition - 20) { - if (vocals.time > Conductor.songPosition + 20 || vocals.time < Conductor.songPosition - 20) - { - resyncVocals(); - } + resyncVocals(); } if (dad.curCharacter == 'spooky' && totalSteps % 4 == 2) From a3ece662fe5cbb0c7f140cf44b003e87ff15a01b Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 16 Feb 2021 00:21:11 -0500 Subject: [PATCH 02/18] icon bullshit and somethin else gitaroo man --- Project.xml | 1 + source/NGio.hx | 1 + source/PlayState.hx | 18 +++++++++--------- source/TitleState.hx | 6 +++++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Project.xml b/Project.xml index a99a8b40d..b525b57c5 100644 --- a/Project.xml +++ b/Project.xml @@ -121,6 +121,7 @@ + diff --git a/source/NGio.hx b/source/NGio.hx index c799c4bd2..f8d8948e5 100644 --- a/source/NGio.hx +++ b/source/NGio.hx @@ -49,6 +49,7 @@ class NGio GAME_VER = response.result.data.currentVersion; GAME_VER_NUMS = GAME_VER.split(" ")[0].trim(); trace('CURRENT NG VERSION: ' + GAME_VER); + trace('CURRENT NG VERSION: ' + GAME_VER_NUMS); gotOnlineVer = true; }); diff --git a/source/PlayState.hx b/source/PlayState.hx index 0af1b0341..7a2953e2d 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1272,7 +1272,14 @@ class PlayState extends MusicBeatState persistentDraw = true; paused = true; - openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); + // 1 / 1000 chance for Gitaroo Man easter egg + if (FlxG.random.bool(0.1)) + { + // gitaroo man easter egg + FlxG.switchState(new GitarooPause()); + } + else + openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); } if (FlxG.keys.justPressed.SEVEN) @@ -1470,14 +1477,7 @@ class PlayState extends MusicBeatState vocals.stop(); FlxG.sound.music.stop(); - // 1 / 1000 chance for Gitaroo Man easter egg - if (FlxG.random.bool(0.1)) - { - // gitaroo man easter egg - FlxG.switchState(new GitarooPause()); - } - else - openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); + openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); // FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); } diff --git a/source/TitleState.hx b/source/TitleState.hx index 6defd5b78..a2ac4af62 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -274,9 +274,13 @@ class TitleState extends MusicBeatState var version:String = "v" + Application.current.meta.get('version'); - if (version.trim() != NGio.GAME_VER_NUMS && !OutdatedSubState.leftState) + if (version.trim() != NGio.GAME_VER_NUMS.trim() && !OutdatedSubState.leftState) { trace('OLD VERSION!'); + trace('old ver'); + trace(version.trim()); + trace('cur ver'); + trace(NGio.GAME_VER_NUMS.trim()); FlxG.switchState(new OutdatedSubState()); } else From 12f8c574844d8ba99408493f87aa0aed175ae259 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 16 Feb 2021 01:53:25 -0500 Subject: [PATCH 03/18] mobile bullshit cookin in progress??? --- Project.xml | 12 +++++----- source/Main.hx | 60 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 7 deletions(-) diff --git a/Project.xml b/Project.xml index b525b57c5..9ebcdccdb 100644 --- a/Project.xml +++ b/Project.xml @@ -2,7 +2,7 @@ - + @@ -27,7 +27,7 @@ - + @@ -94,9 +94,9 @@ - - - + + + @@ -121,7 +121,7 @@ - + diff --git a/source/Main.hx b/source/Main.hx index 13376db44..7f287f87e 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -1,15 +1,73 @@ package; import flixel.FlxGame; +import flixel.FlxState; +import openfl.Assets; +import openfl.Lib; import openfl.display.FPS; import openfl.display.Sprite; +import openfl.events.Event; class Main extends Sprite { + var gameWidth:Int = 1280; // Width of the game in pixels (might be less / more in actual pixels depending on your zoom). + var gameHeight:Int = 720; // Height of the game in pixels (might be less / more in actual pixels depending on your zoom). + var initialState:Class = TitleState; // The FlxState the game starts with. + var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions. + var framerate:Int = 60; // How many frames per second the game should run at. + var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode. + var startFullscreen:Bool = false; // Whether to start the game in fullscreen on desktop targets + + // You can pretty much ignore everything from here on - your code should go in your states. + + public static function main():Void + { + Lib.current.addChild(new Main()); + } + public function new() { super(); - addChild(new FlxGame(0, 0, TitleState)); + + if (stage != null) + { + init(); + } + else + { + addEventListener(Event.ADDED_TO_STAGE, init); + } + } + + private function init(?E:Event):Void + { + if (hasEventListener(Event.ADDED_TO_STAGE)) + { + removeEventListener(Event.ADDED_TO_STAGE, init); + } + + setupGame(); + } + + private function setupGame():Void + { + var stageWidth:Int = Lib.current.stage.stageWidth; + var stageHeight:Int = Lib.current.stage.stageHeight; + + if (zoom == -1) + { + var ratioX:Float = stageWidth / gameWidth; + var ratioY:Float = stageHeight / gameHeight; + zoom = Math.min(ratioX, ratioY); + gameWidth = Math.ceil(stageWidth / zoom); + gameHeight = Math.ceil(stageHeight / zoom); + } + + #if !debug + initialState = TitleState; + #end + + addChild(new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen)); #if !mobile addChild(new FPS(10, 3, 0xFFFFFF)); From 418c9a06c77c167e1c0e66274662616c2941466e Mon Sep 17 00:00:00 2001 From: Tenta <72235309+TentaRJ@users.noreply.github.com> Date: Wed, 17 Feb 2021 18:43:50 -0500 Subject: [PATCH 04/18] README.md update for Haxe 4.1.5 --- README.md | 183 +++++++++++++++++++++++++++--------------------------- 1 file changed, 91 insertions(+), 92 deletions(-) diff --git a/README.md b/README.md index 8b70997e2..80f0f946f 100644 --- a/README.md +++ b/README.md @@ -1,92 +1,91 @@ -# Friday Night Funkin - -This is the repository for Friday Night Funkin, a game originally made for Ludum Dare 47 "Stuck In a Loop". - -Play the Ludum Dare prototype here: https://ninja-muffin24.itch.io/friday-night-funkin -Play the Newgrounds one here: https://www.newgrounds.com/portal/view/770371 -Support the project on the itch.io page: https://ninja-muffin24.itch.io/funkin - -## Credits / shoutouts - -- [ninjamuffin99 (me!)](https://twitter.com/ninja_muffin99) - Programmer -- [PhantomArcade3K](https://twitter.com/phantomarcade3k) and [Evilsk8r](https://twitter.com/evilsk8r) - Art -- [Kawaisprite](https://twitter.com/kawaisprite) - Musician - -This game was made with love to Newgrounds and it's community. Extra love to Tom Fulp. - -## Build instructions - -THESE INSTRUCTIONS ARE FOR COMPILING THE GAME'S SOURCE CODE!!! - -IF YOU WANT TO JUST DOWNLOAD AND INSTALL AND PLAY THE GAME NORMALLY, GO TO ITCH.IO TO DOWNLOAD THE GAME FOR PC, MAC, AND LINUX!! - -https://ninja-muffin24.itch.io/friday-night-funkin - -IF YOU WANT TO COMPILE THE GAME YOURSELF, CONTINUE READING!!! - -### Installing shit - -First you need to install Haxe and HaxeFlixel. I'm too lazy to write and keep updated with that setup (which is pretty simple). -The link to that is on the [HaxeFlixel website](https://haxeflixel.com/documentation/getting-started/) - -Other installations you'd need is the additional libraries, a fully updated list will be in `Project.xml` in the project root, but here are the one's I'm using as of writing. - -``` -hscript -flixel-ui -newgrounds -``` - -So for each of those type `haxelib install [library]` so shit like `haxelib install newgrounds` - -You'll also need to install polymod. Do this with - -``` -haxelib git polymod https://github.com/larsiusprime/polymod.git -``` - -### Ignored files - -I gitignore the API keys for the game, so that no one can nab them and post fake highscores on the leaderboards. But because of that the game -doesn't compile without it. - -Just make a file in `/source` and call it `APIStuff.hx`, and copy paste this into it - -```haxe -package; - -class APIStuff -{ - public static var API:String = ""; - public static var EncKey:String = ""; -} - -``` - -and you should be good to go there. - -### Compiling game - -Once you have all those installed, it's pretty easy to compile the game. You just need to run 'lime test html5 -debug' in the root of the project to build and run the HTML5 version. (command prompt navigation guide can be found here: [https://ninjamuffin99.newgrounds.com/news/post/1090480](https://ninjamuffin99.newgrounds.com/news/post/1090480)) - -To run it from your desktop (Windows, Mac, Linux) it can be a bit more involved. For Linux, you only need to open a terminal in the project directory and run 'lime test linux -debug' and then run the executible file in export/release/linux/bin. For Windows, you need to install Visual Studio Community 2019. While installing VSC, don't click on any of the options to install workloads. Instead, go to the individual components tab and choose the following: -* MSVC v142 - VS 2019 C++ x64/x86 build tools -* Windows SDK (10.0.17763.0) -* C++ Profiling tools -* C++ CMake tools for windows -* C++ ATL for v142 build tools (x86 & x64) -* C++ MFC for v142 build tools (x86 & x64) -* C++/CLI support for v142 build tools (14.21) -* C++ Modules for v142 build tools (x64/x86) -* Clang Compiler for Windows -* Windows 10 SDK (10.0.17134.0) -* Windows 10 SDK (10.0.16299.0) -* MSVC v141 - VS 2017 C++ x64/x86 build tools -* MSVC v140 - VS 2015 C++ build tools (v14.00) - -This will install about 22GB of crap, but once that is done you can open up a command line in the project's directory and run `lime test windows -debug`. Once that command finishes (it takes forever even on a higher end PC), you can run FNF from the .exe file under export\release\windows\bin -As for Mac, 'lime test mac -debug' should work, if not the internet surely has a guide on how to compile Haxe stuff for Mac. - -### Additional guides - -- [Command line basics](https://ninjamuffin99.newgrounds.com/news/post/1090480) +# Friday Night Funkin + +This is the repository for Friday Night Funkin, a game originally made for Ludum Dare 47 "Stuck In a Loop". + +Play the Ludum Dare prototype here: https://ninja-muffin24.itch.io/friday-night-funkin +Play the Newgrounds one here: https://www.newgrounds.com/portal/view/770371 +Support the project on the itch.io page: https://ninja-muffin24.itch.io/funkin + +## Credits / shoutouts + +- [ninjamuffin99 (me!)](https://twitter.com/ninja_muffin99) - Programmer +- [PhantomArcade3K](https://twitter.com/phantomarcade3k) and [Evilsk8r](https://twitter.com/evilsk8r) - Art +- [Kawaisprite](https://twitter.com/kawaisprite) - Musician + +This game was made with love to Newgrounds and it's community. Extra love to Tom Fulp. + +## Build instructions + +THESE INSTRUCTIONS ARE FOR COMPILING THE GAME'S SOURCE CODE!!! + +IF YOU WANT TO JUST DOWNLOAD AND INSTALL AND PLAY THE GAME NORMALLY, GO TO ITCH.IO TO DOWNLOAD THE GAME FOR PC, MAC, AND LINUX!! + +https://ninja-muffin24.itch.io/friday-night-funkin + +IF YOU WANT TO COMPILE THE GAME YOURSELF, CONTINUE READING!!! + +### Installing shit + +First you need to install Haxe and HaxeFlixel. I'm too lazy to write and keep updated with that setup (which is pretty simple). +1. [Install Haxe 4.1.5](https://haxe.org/download/version/4.1.5/) (Download 4.1.5 instead of 4.2.0 because 4.2.0 is broken and is not working with gits properly...) +2. [Install HaxeFlixel](https://haxeflixel.com/documentation/install-haxeflixel/) after downloading Haxe + +Other installations you'd need is the additional libraries, a fully updated list will be in `Project.xml` in the project root, but here are the one's I'm using as of writing. + +``` +hscript +flixel-ui +newgrounds +``` + +So for each of those type `haxelib install [library]` so shit like `haxelib install newgrounds` + +You'll also need to install polymod. To do this, you need to do two things first. +1. For Windows: [Download GitForWindows](https://gitforwindows.org/) to use gits. +2. Run `haxelib git polymod https://github.com/larsiusprime/polymod.git` after GitForWindows is installed + +### Ignored files + +I gitignore the API keys for the game, so that no one can nab them and post fake highscores on the leaderboards. But because of that the game +doesn't compile without it. + +Just make a file in `/source` and call it `APIStuff.hx`, and copy paste this into it + +```haxe +package; + +class APIStuff +{ + public static var API:String = ""; + public static var EncKey:String = ""; +} + +``` + +and you should be good to go there. + +### Compiling game + +Once you have all those installed, it's pretty easy to compile the game. You just need to run 'lime test html5 -debug' in the root of the project to build and run the HTML5 version. (command prompt navigation guide can be found here: [https://ninjamuffin99.newgrounds.com/news/post/1090480](https://ninjamuffin99.newgrounds.com/news/post/1090480)) + +To run it from your desktop (Windows, Mac, Linux) it can be a bit more involved. For Linux, you only need to open a terminal in the project directory and run 'lime test linux -debug' and then run the executible file in export/release/linux/bin. For Windows, you need to install Visual Studio Community 2019. While installing VSC, don't click on any of the options to install workloads. Instead, go to the individual components tab and choose the following: +* MSVC v142 - VS 2019 C++ x64/x86 build tools +* Windows SDK (10.0.17763.0) +* C++ Profiling tools +* C++ CMake tools for windows +* C++ ATL for v142 build tools (x86 & x64) +* C++ MFC for v142 build tools (x86 & x64) +* C++/CLI support for v142 build tools (14.21) +* C++ Modules for v142 build tools (x64/x86) +* Clang Compiler for Windows +* Windows 10 SDK (10.0.17134.0) +* Windows 10 SDK (10.0.16299.0) +* MSVC v141 - VS 2017 C++ x64/x86 build tools +* MSVC v140 - VS 2015 C++ build tools (v14.00) + +This will install about 22GB of crap, but once that is done you can open up a command line in the project's directory and run `lime test windows -debug`. Once that command finishes (it takes forever even on a higher end PC), you can run FNF from the .exe file under export\release\windows\bin +As for Mac, 'lime test mac -debug' should work, if not the internet surely has a guide on how to compile Haxe stuff for Mac. + +### Additional guides + +- [Command line basics](https://ninjamuffin99.newgrounds.com/news/post/1090480) \ No newline at end of file From ec13d22ae7c51ec1320d82f8f8189805208383bf Mon Sep 17 00:00:00 2001 From: Tenta <72235309+TentaRJ@users.noreply.github.com> Date: Wed, 17 Feb 2021 19:32:49 -0500 Subject: [PATCH 05/18] Update README.md --- README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 80f0f946f..2c40ffc1c 100644 --- a/README.md +++ b/README.md @@ -24,25 +24,28 @@ https://ninja-muffin24.itch.io/friday-night-funkin IF YOU WANT TO COMPILE THE GAME YOURSELF, CONTINUE READING!!! -### Installing shit +### Installing the Required Programs First you need to install Haxe and HaxeFlixel. I'm too lazy to write and keep updated with that setup (which is pretty simple). 1. [Install Haxe 4.1.5](https://haxe.org/download/version/4.1.5/) (Download 4.1.5 instead of 4.2.0 because 4.2.0 is broken and is not working with gits properly...) 2. [Install HaxeFlixel](https://haxeflixel.com/documentation/install-haxeflixel/) after downloading Haxe -Other installations you'd need is the additional libraries, a fully updated list will be in `Project.xml` in the project root, but here are the one's I'm using as of writing. - +Other installations you'd need is the additional libraries, a fully updated list will be in `Project.xml` in the project root. Currently, these are all of the things you need to install: ``` -hscript +flixel +flixel-addons flixel-ui +hscript newgrounds ``` - So for each of those type `haxelib install [library]` so shit like `haxelib install newgrounds` -You'll also need to install polymod. To do this, you need to do two things first. -1. For Windows: [Download GitForWindows](https://gitforwindows.org/) to use gits. -2. Run `haxelib git polymod https://github.com/larsiusprime/polymod.git` after GitForWindows is installed +You'll also need to install polymod. To do this, you need to do a few things first. +1. Download [git-scm](https://git-scm.com/downloads). Works for Windows, Mac, and Linux, just select your build. +2. Follow instructions to install the application properly. +3. Run `haxelib git polymod https://github.com/larsiusprime/polymod.git` in terminal/command-prompt after your git program is installed. + +You should have everything ready for compiling the game! Follow the guide below to continue! ### Ignored files @@ -88,4 +91,4 @@ As for Mac, 'lime test mac -debug' should work, if not the internet surely has a ### Additional guides -- [Command line basics](https://ninjamuffin99.newgrounds.com/news/post/1090480) \ No newline at end of file +- [Command line basics](https://ninjamuffin99.newgrounds.com/news/post/1090480) From b83bb877d0a1a52b910816d700a729c6083aea98 Mon Sep 17 00:00:00 2001 From: MtH Date: Sat, 20 Feb 2021 01:22:23 +0100 Subject: [PATCH 06/18] fix several issues caused by sustain notes no longer being removed after correctly hit --- source/Note.hx | 8 ++------ source/PlayState.hx | 31 ++++++++++++------------------- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/source/Note.hx b/source/Note.hx index 2b04b5985..ee1a8693d 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -171,16 +171,14 @@ class Note extends FlxSprite if (mustPress) { - // The * 0.5 us so that its easier to hit them too late, instead of too early + // The * 0.5 is so that it's easier to hit them too late, instead of too early if (strumTime > Conductor.songPosition - Conductor.safeZoneOffset && strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.5)) - { canBeHit = true; - } else canBeHit = false; - if (strumTime < Conductor.songPosition - Conductor.safeZoneOffset) + if (strumTime < Conductor.songPosition - Conductor.safeZoneOffset && !wasGoodHit) tooLate = true; } else @@ -188,9 +186,7 @@ class Note extends FlxSprite canBeHit = false; if (strumTime <= Conductor.songPosition) - { wasGoodHit = true; - } } if (tooLate) diff --git a/source/PlayState.hx b/source/PlayState.hx index 7a2953e2d..425f93e0a 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1563,27 +1563,18 @@ class PlayState extends MusicBeatState if (daNote.y < -daNote.height) { - if (daNote.isSustainNote && daNote.wasGoodHit) + if (daNote.tooLate || !daNote.wasGoodHit) { - daNote.kill(); - notes.remove(daNote, true); - daNote.destroy(); + health -= 0.0475; + vocals.volume = 0; } - else - { - if (daNote.tooLate || !daNote.wasGoodHit) - { - health -= 0.0475; - vocals.volume = 0; - } - daNote.active = false; - daNote.visible = false; + daNote.active = false; + daNote.visible = false; - daNote.kill(); - notes.remove(daNote, true); - daNote.destroy(); - } + daNote.kill(); + notes.remove(daNote, true); + daNote.destroy(); } }); } @@ -1864,7 +1855,7 @@ class PlayState extends MusicBeatState notes.forEachAlive(function(daNote:Note) { - if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate) + if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit) { // the sorting probably doesn't need to be in here? who cares lol possibleNotes.push(daNote); @@ -1940,13 +1931,15 @@ class PlayState extends MusicBeatState if (upP || rightP || downP || leftP) noteCheck(leftP, daNote); } - */ + + //this is already done in noteCheck / goodNoteHit if (daNote.wasGoodHit) { daNote.kill(); notes.remove(daNote, true); daNote.destroy(); } + */ } else { From d2062f41b6bf807f8c2c62717b3d6a46d4b7473c Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 23 Feb 2021 23:14:18 -0500 Subject: [PATCH 07/18] small shit characters dunno this shit weird lol --- source/Character.hx | 4 ++-- source/PlayState.hx | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/Character.hx b/source/Character.hx index 4177e2b52..e13abdee9 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -622,8 +622,8 @@ class Character extends FlxSprite { animation.play(AnimName, Force, Reversed, Frame); - var daOffset = animOffsets.get(animation.curAnim.name); - if (animOffsets.exists(animation.curAnim.name)) + var daOffset = animOffsets.get(AnimName); + if (animOffsets.exists(AnimName)) { offset.set(daOffset[0], daOffset[1]); } diff --git a/source/PlayState.hx b/source/PlayState.hx index 647357157..663127143 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -124,6 +124,10 @@ class PlayState extends MusicBeatState override public function create() { + + if (FlxG.sound.music != null) + FlxG.sound.music.stop(); + // var gameCam:FlxCamera = FlxG.camera; camGame = new FlxCamera(); camHUD = new FlxCamera(); From a6deae4796d2a57452b54635b0079975047ab295 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 23 Feb 2021 23:32:53 -0500 Subject: [PATCH 08/18] bullshit lol --- source/TitleState.hx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/TitleState.hx b/source/TitleState.hx index a2ac4af62..d1fa230a2 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -237,6 +237,16 @@ class TitleState extends MusicBeatState var pressedEnter:Bool = FlxG.keys.justPressed.ENTER; + #if mobile + for (touch in FlxG.touches.list) + { + if (touch.justPressed) + { + pressedEnter = true; + } + } + #end + var gamepad:FlxGamepad = FlxG.gamepads.lastActive; if (gamepad != null) From 10ecc85baff08ec1eea902225f6f4b21aee3b83c Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 24 Feb 2021 18:32:51 -0500 Subject: [PATCH 09/18] options menu in progress --- Project.xml | 2 +- source/ControlsSubState.hx | 4 +++ source/MainMenuState.hx | 4 ++- source/Options.hx | 6 ++++ source/OptionsMenu.hx | 58 ++++++++++++++++++++---------------- source/OptionsSubState.hx | 61 +++++++++++++++++++++++++++++++++++++- 6 files changed, 106 insertions(+), 29 deletions(-) create mode 100644 source/Options.hx diff --git a/Project.xml b/Project.xml index e1a9f1252..7edddb77c 100644 --- a/Project.xml +++ b/Project.xml @@ -18,7 +18,7 @@ - + diff --git a/source/ControlsSubState.hx b/source/ControlsSubState.hx index d63e978e1..236d4a646 100644 --- a/source/ControlsSubState.hx +++ b/source/ControlsSubState.hx @@ -1,5 +1,6 @@ package; +import flixel.FlxSprite; import flixel.FlxSubState; class ControlsSubState extends FlxSubState @@ -7,5 +8,8 @@ class ControlsSubState extends FlxSubState public function new() { super(); + + var bullshit = new FlxSprite().makeGraphic(100, 100); + add(bullshit); } } diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index 4b6a0464d..4b3a8f110 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -23,7 +23,7 @@ class MainMenuState extends MusicBeatState var menuItems:FlxTypedGroup; #if !switch - var optionShit:Array = ['story mode', 'freeplay', 'donate']; + var optionShit:Array = ['story mode', 'freeplay', 'donate', 'options']; #else var optionShit:Array = ['story mode', 'freeplay']; #end @@ -174,6 +174,8 @@ class MainMenuState extends MusicBeatState trace("Freeplay Menu Selected"); case 'options': + FlxTransitionableState.skipNextTransIn = true; + FlxTransitionableState.skipNextTransOut = true; FlxG.switchState(new OptionsMenu()); } }); diff --git a/source/Options.hx b/source/Options.hx new file mode 100644 index 000000000..f392a8b1e --- /dev/null +++ b/source/Options.hx @@ -0,0 +1,6 @@ +package; + +class Options +{ + public static var masterVolume:Float = 1; +} diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index bf36c83d5..0c5b284cc 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -32,44 +32,50 @@ class OptionsMenu extends MusicBeatState menuBG.antialiasing = true; add(menuBG); - grpControls = new FlxTypedGroup(); - add(grpControls); + /* + grpControls = new FlxTypedGroup(); + add(grpControls); - for (i in 0...controlsStrings.length) - { - if (controlsStrings[i].indexOf('set') != -1) + for (i in 0...controlsStrings.length) { - var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i].substring(3) + ': ' + controlsStrings[i + 1], true, false); - controlLabel.isMenuItem = true; - controlLabel.targetY = i; - grpControls.add(controlLabel); + if (controlsStrings[i].indexOf('set') != -1) + { + var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i].substring(3) + ': ' + controlsStrings[i + 1], true, false); + controlLabel.isMenuItem = true; + controlLabel.targetY = i; + grpControls.add(controlLabel); + } + // DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! } - // DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! - } + */ super.create(); + + openSubState(new OptionsSubState()); } override function update(elapsed:Float) { super.update(elapsed); - if (controls.ACCEPT) - { - changeBinding(); - } + /* + if (controls.ACCEPT) + { + changeBinding(); + } - if (isSettingControl) - waitingInput(); - else - { - if (controls.BACK) - FlxG.switchState(new MainMenuState()); - if (controls.UP_P) - changeSelection(-1); - if (controls.DOWN_P) - changeSelection(1); - } + if (isSettingControl) + waitingInput(); + else + { + if (controls.BACK) + FlxG.switchState(new MainMenuState()); + if (controls.UP_P) + changeSelection(-1); + if (controls.DOWN_P) + changeSelection(1); + } + */ } function waitingInput():Void diff --git a/source/OptionsSubState.hx b/source/OptionsSubState.hx index 1995b868a..2b63e0c2f 100644 --- a/source/OptionsSubState.hx +++ b/source/OptionsSubState.hx @@ -1,11 +1,70 @@ package; +import flixel.FlxG; +import flixel.FlxSprite; +import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.text.FlxText; +import flixel.util.FlxColor; + class OptionsSubState extends MusicBeatSubstate { - var textMenuItems:Array = ['Master Volume', 'Sound Volume']; + var textMenuItems:Array = ['Master Volume', 'Sound Volume', 'Controls']; + + var selector:FlxSprite; + var curSelected:Int = 0; + + var grpOptionsTexts:FlxTypedGroup; public function new() { super(); + + grpOptionsTexts = new FlxTypedGroup(); + add(grpOptionsTexts); + + selector = new FlxSprite().makeGraphic(5, 5, FlxColor.RED); + add(selector); + + for (i in 0...textMenuItems.length) + { + var optionText:FlxText = new FlxText(20, 20 + (i * 50), 0, textMenuItems[i], 32); + optionText.ID = i; + grpOptionsTexts.add(optionText); + } + } + + override function update(elapsed:Float) + { + super.update(elapsed); + + if (controls.UP_P) + curSelected -= 1; + + if (controls.DOWN_P) + curSelected += 1; + + if (curSelected < 0) + curSelected = textMenuItems.length - 1; + + if (curSelected >= textMenuItems.length) + curSelected = 0; + + grpOptionsTexts.forEach(function(txt:FlxText) + { + txt.color = FlxColor.WHITE; + + if (txt.ID == curSelected) + txt.color = FlxColor.YELLOW; + }); + + if (controls.ACCEPT) + { + switch (textMenuItems[curSelected]) + { + case "Controls": + FlxG.state.closeSubState(); + FlxG.state.openSubState(new ControlsSubState()); + } + } } } From 3e65da6d9d7c844f8a7314d28b790341815b3f94 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 24 Feb 2021 19:06:41 -0500 Subject: [PATCH 10/18] bopeebo note thing --- CHANGELOG.md | 7 +++++++ source/ControlsSubState.hx | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c650752ab..cc5d7fa84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,18 @@ All notable changes will be documented in this file. 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] +### Changed +- ASSET LOADING OVERHAUL, WAY FASTER LOAD TIMES ON WEB!!! (THANKS TO GEOKURELI WOKE KING) +### Fixed +- That one random note on Bopeebo + ## [0.2.7.1] - 2021-02-14 ### Added - Easter eggs - readme's in desktop versions of the game ### Changed + - New icons, old one was placeholder since October woops! - Made the transitions between the story mode levels more seamless. - Offset of the Newgrounds logo on boot screen. diff --git a/source/ControlsSubState.hx b/source/ControlsSubState.hx index 236d4a646..f35d74cc8 100644 --- a/source/ControlsSubState.hx +++ b/source/ControlsSubState.hx @@ -8,8 +8,5 @@ class ControlsSubState extends FlxSubState public function new() { super(); - - var bullshit = new FlxSprite().makeGraphic(100, 100); - add(bullshit); } } From 3882de4ad8b30e39326d62ad25f9d5618e3d0458 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 24 Feb 2021 20:22:37 -0500 Subject: [PATCH 11/18] freeplay fixin shit --- source/Character.hx | 3 ++- source/FreeplayState.hx | 5 +++++ source/StoryMenuState.hx | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/Character.hx b/source/Character.hx index e13abdee9..810d21047 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -1,5 +1,6 @@ package; +import flixel.FlxG; import flixel.FlxSprite; import flixel.animation.FlxBaseAnimation; import flixel.graphics.frames.FlxAtlasFrames; @@ -18,9 +19,9 @@ class Character extends FlxSprite public function new(x:Float, y:Float, ?character:String = "bf", ?isPlayer:Bool = false) { - animOffsets = new Map>(); super(x, y); + animOffsets = new Map>(); curCharacter = character; this.isPlayer = isPlayer; diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index b39ebc973..32e02359d 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -50,6 +50,7 @@ class FreeplayState extends MusicBeatState { songs.push('Spookeez'); songs.push('South'); + songs.push('Monster'); } if (StoryMenuState.weekUnlocked[3] || isDebug) @@ -198,6 +199,10 @@ class FreeplayState extends MusicBeatState PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].toLowerCase()); PlayState.isStoryMode = false; PlayState.storyDifficulty = curDifficulty; + + // QUICK DUMB MATH + // gets story week from currently selected, will be fuckie if things are NOT in order! + PlayState.storyWeek = Math.ceil((curSelected + 1) / 3); LoadingState.loadAndSwitchState(new PlayState()); } } diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index adb9d6cb3..1156ccade 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -22,7 +22,7 @@ class StoryMenuState extends MusicBeatState var weekData:Array = [ ['Tutorial'], ['Bopeebo', 'Fresh', 'Dadbattle'], - ['Spookeez', 'South'], + ['Spookeez', 'South', "Monster"], ['Pico', 'Philly', "Blammed"], ['Satin-Panties', "High", "Milf"], ['Cocoa', 'Eggnog', 'Winter-Horrorland'], From b1b3df25b5dcceb8ae70bdc385c1584e9e6bd071 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 24 Feb 2021 20:52:59 -0500 Subject: [PATCH 12/18] week metadata bullshit for free[;ay --- source/FreeplayState.hx | 82 ++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 32e02359d..f8bb333e9 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -14,7 +14,7 @@ using StringTools; class FreeplayState extends MusicBeatState { - var songs:Array = []; + var songs:Array = []; var selector:FlxText; var curSelected:Int = 0; @@ -30,7 +30,12 @@ class FreeplayState extends MusicBeatState override function create() { - songs = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); + var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); + + for (i in 0...initSonglist.length) + { + songs.push(new SongMetadata(initSonglist[i], 1)); + } /* if (FlxG.sound.music != null) @@ -47,40 +52,19 @@ class FreeplayState extends MusicBeatState #end if (StoryMenuState.weekUnlocked[2] || isDebug) - { - songs.push('Spookeez'); - songs.push('South'); - songs.push('Monster'); - } + addWeek(['Spookeez', 'South', 'Monster'], 2); if (StoryMenuState.weekUnlocked[3] || isDebug) - { - songs.push('Pico'); - songs.push('Philly'); - songs.push('Blammed'); - } + addWeek(['Pico', 'Philly', 'Blammed'], 3); if (StoryMenuState.weekUnlocked[4] || isDebug) - { - songs.push('Satin-Panties'); - songs.push('High'); - songs.push('Milf'); - } + addWeek(['Satin-Panties', 'High', 'Milf'], 4); if (StoryMenuState.weekUnlocked[5] || isDebug) - { - songs.push('Cocoa'); - songs.push('Eggnog'); - songs.push('Winter-Horrorland'); - } + addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5); if (StoryMenuState.weekUnlocked[6] || isDebug) - { - songs.push('Senpai'); - songs.push('Roses'); - songs.push('Thorns'); - // songs.push('Winter-Horrorland'); - } + addWeek(['Senpai', 'Roses', 'Thorns'], 6); // LOAD MUSIC @@ -94,7 +78,7 @@ class FreeplayState extends MusicBeatState for (i in 0...songs.length) { - var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i], true, false); + var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i].songName, true, false); songText.isMenuItem = true; songText.targetY = i; grpSongs.add(songText); @@ -151,6 +135,19 @@ class FreeplayState extends MusicBeatState super.create(); } + public function addSong(songName:String, weekNum:Int) + { + songs.push(new SongMetadata(songName, weekNum)); + } + + public function addWeek(songs:Array, weekNum:Int) + { + for (song in songs) + { + addSong(song, weekNum); + } + } + override function update(elapsed:Float) { super.update(elapsed); @@ -192,17 +189,16 @@ class FreeplayState extends MusicBeatState if (accepted) { - var poop:String = Highscore.formatSong(songs[curSelected].toLowerCase(), curDifficulty); + var poop:String = Highscore.formatSong(songs[curSelected].songName.toLowerCase(), curDifficulty); trace(poop); - PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].toLowerCase()); + PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].songName.toLowerCase()); PlayState.isStoryMode = false; PlayState.storyDifficulty = curDifficulty; - // QUICK DUMB MATH - // gets story week from currently selected, will be fuckie if things are NOT in order! - PlayState.storyWeek = Math.ceil((curSelected + 1) / 3); + PlayState.storyWeek = songs[curSelected].week; + trace('CUR WEEK' + PlayState.storyWeek); LoadingState.loadAndSwitchState(new PlayState()); } } @@ -217,7 +213,7 @@ class FreeplayState extends MusicBeatState curDifficulty = 0; #if !switch - intendedScore = Highscore.getScore(songs[curSelected], curDifficulty); + intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty); #end switch (curDifficulty) @@ -250,12 +246,12 @@ class FreeplayState extends MusicBeatState // selector.y = (70 * curSelected) + 30; #if !switch - intendedScore = Highscore.getScore(songs[curSelected], curDifficulty); + intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty); // lerpScore = 0; #end #if PRELOAD_ALL - FlxG.sound.playMusic(Paths.inst(songs[curSelected]), 0); + FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0); #end var bullShit:Int = 0; @@ -276,3 +272,15 @@ class FreeplayState extends MusicBeatState } } } + +class SongMetadata +{ + public var songName:String = ""; + public var week:Int = 0; + + public function new(song:String, week:Int) + { + this.songName = song; + this.week = week; + } +} From 99a0ccf66fce1e0361ac0ab5655bc2330ad7d693 Mon Sep 17 00:00:00 2001 From: M&M Date: Sun, 28 Feb 2021 19:42:45 -0800 Subject: [PATCH 13/18] add transition fix to readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 2c40ffc1c..d4ad6bcdc 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,9 @@ You'll also need to install polymod. To do this, you need to do a few things fir You should have everything ready for compiling the game! Follow the guide below to continue! +At the moment, you can optionally fix the transition bug in songs with zoomed out cameras. +- Run `haxelib git flixel-addons https://github.com/HaxeFlixel/flixel-addons` in the terminal/command-prompt. + ### Ignored files I gitignore the API keys for the game, so that no one can nab them and post fake highscores on the leaderboards. But because of that the game From 15a57a34affa312f64e9973b979f4c80c287db25 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 1 Mar 2021 16:46:08 -0500 Subject: [PATCH 14/18] song icon formatting --- source/FreeplayState.hx | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index f8bb333e9..d00b40264 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -34,7 +34,7 @@ class FreeplayState extends MusicBeatState for (i in 0...initSonglist.length) { - songs.push(new SongMetadata(initSonglist[i], 1)); + songs.push(new SongMetadata(initSonglist[i], 1, 'dad')); } /* @@ -52,19 +52,19 @@ class FreeplayState extends MusicBeatState #end if (StoryMenuState.weekUnlocked[2] || isDebug) - addWeek(['Spookeez', 'South', 'Monster'], 2); + addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']); if (StoryMenuState.weekUnlocked[3] || isDebug) - addWeek(['Pico', 'Philly', 'Blammed'], 3); + addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']); if (StoryMenuState.weekUnlocked[4] || isDebug) - addWeek(['Satin-Panties', 'High', 'Milf'], 4); + addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']); if (StoryMenuState.weekUnlocked[5] || isDebug) - addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5); + addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']); if (StoryMenuState.weekUnlocked[6] || isDebug) - addWeek(['Senpai', 'Roses', 'Thorns'], 6); + addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']); // LOAD MUSIC @@ -135,16 +135,23 @@ class FreeplayState extends MusicBeatState super.create(); } - public function addSong(songName:String, weekNum:Int) + public function addSong(songName:String, weekNum:Int, songCharacter:String) { - songs.push(new SongMetadata(songName, weekNum)); + songs.push(new SongMetadata(songName, weekNum, songCharacter)); } - public function addWeek(songs:Array, weekNum:Int) + public function addWeek(songs:Array, weekNum:Int, ?songCharacters:Array) { + if (songCharacters == null) + songCharacters = ['bf']; + + var num:Int = 0; for (song in songs) { - addSong(song, weekNum); + addSong(song, weekNum, songCharacters[num]); + + if (songCharacters.length != 1) + num++; } } @@ -277,10 +284,12 @@ class SongMetadata { public var songName:String = ""; public var week:Int = 0; + public var songCharacter:String = ""; - public function new(song:String, week:Int) + public function new(song:String, week:Int, songCharacter:String) { this.songName = song; this.week = week; + this.songCharacter = songCharacter; } } From be95f5a298723fd3c12804947e88a09c7ad3df5d Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 1 Mar 2021 18:59:51 -0500 Subject: [PATCH 15/18] freeplay menu polish thingie --- source/FreeplayState.hx | 10 +++++++++- source/HealthIcon.hx | 13 +++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index d00b40264..464ba7452 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -34,7 +34,7 @@ class FreeplayState extends MusicBeatState for (i in 0...initSonglist.length) { - songs.push(new SongMetadata(initSonglist[i], 1, 'dad')); + songs.push(new SongMetadata(initSonglist[i], 1, 'gf')); } /* @@ -51,6 +51,9 @@ class FreeplayState extends MusicBeatState isDebug = true; #end + if (StoryMenuState.weekUnlocked[2] || isDebug) + addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']); + if (StoryMenuState.weekUnlocked[2] || isDebug) addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']); @@ -82,6 +85,11 @@ class FreeplayState extends MusicBeatState songText.isMenuItem = true; songText.targetY = i; grpSongs.add(songText); + + var icon:HealthIcon = new HealthIcon(songs[i].songCharacter); + icon.sprTracker = songText; + add(icon); + // songText.x += 40; // DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! // songText.screenCenter(X); diff --git a/source/HealthIcon.hx b/source/HealthIcon.hx index a7c71578a..ff967e990 100644 --- a/source/HealthIcon.hx +++ b/source/HealthIcon.hx @@ -4,6 +4,11 @@ import flixel.FlxSprite; class HealthIcon extends FlxSprite { + /** + * Used for FreeplayState! If you use it elsewhere, prob gonna annoying + */ + public var sprTracker:FlxSprite; + public function new(char:String = 'bf', isPlayer:Bool = false) { super(); @@ -32,4 +37,12 @@ class HealthIcon extends FlxSprite animation.play(char); scrollFactor.set(); } + + override function update(elapsed:Float) + { + super.update(elapsed); + + if (sprTracker != null) + setPosition(sprTracker.x + sprTracker.width + 10, sprTracker.y - 30); + } } From eeda572c3ee5aec14da4aedbe227d41475c80475 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 1 Mar 2021 22:35:27 -0500 Subject: [PATCH 16/18] easier storymode menu adding onto --- source/MenuItem.hx | 42 ++++++++++++++++++++++++---------------- source/StoryMenuState.hx | 2 +- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/source/MenuItem.hx b/source/MenuItem.hx index fe3c9f238..f41d893c7 100644 --- a/source/MenuItem.hx +++ b/source/MenuItem.hx @@ -1,41 +1,49 @@ package; +import flixel.FlxG; import flixel.FlxSprite; import flixel.graphics.frames.FlxAtlasFrames; import flixel.group.FlxSpriteGroup; import flixel.math.FlxMath; +import flixel.util.FlxColor; class MenuItem extends FlxSpriteGroup { public var targetY:Float = 0; public var week:FlxSprite; + public var flashingInt:Int = 0; public function new(x:Float, y:Float, weekNum:Int = 0) { super(x, y); - - var tex = Paths.getSparrowAtlas('campaign_menu_UI_assets'); - - week = new FlxSprite(); - week.frames = tex; - // TUTORIAL IS WEEK 0 - week.animation.addByPrefix('week0', 'tutorial selected', 24); - week.animation.addByPrefix('week1', "WEEK1 select", 24); - week.animation.addByPrefix('week2', "week2 select", 24); - week.animation.addByPrefix('week3', "Week 3 press", 24); - week.animation.addByPrefix('week4', "Week 4 press", 24); - week.animation.addByPrefix('week5', "week 5", 24); - week.animation.addByPrefix('week6', "Week 6", 24); + week = new FlxSprite().loadGraphic(Paths.image('storymenu/week' + weekNum)); add(week); - - week.animation.play('week' + weekNum); - week.animation.pause(); - week.updateHitbox(); } + private var isFlashing:Bool = false; + + public function startFlashing():Void + { + isFlashing = true; + } + + // if it runs at 60fps, fake framerate will be 6 + // if it runs at 144 fps, fake framerate will be like 14, and will update the graphic every 0.016666 * 3 seconds still??? + // so it runs basically every so many seconds, not dependant on framerate?? + // I'm still learning how math works thanks whoever is reading this lol + var fakeFramerate:Int = Math.round((1 / FlxG.elapsed) / 10); + override function update(elapsed:Float) { super.update(elapsed); y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17); + + if (isFlashing) + flashingInt += 1; + + if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2)) + week.color = 0xFF33ffff; + else + week.color = FlxColor.WHITE; } } diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index 1156ccade..1e27eed7c 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -291,7 +291,7 @@ class StoryMenuState extends MusicBeatState { FlxG.sound.play(Paths.sound('confirmMenu')); - grpWeekText.members[curWeek].week.animation.resume(); + grpWeekText.members[curWeek].startFlashing(); grpWeekCharacters.members[1].animation.play('bfConfirm'); stopspamming = true; } From fee7a7746c62c57d36dab64e69b942c7d9459f36 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 1 Mar 2021 23:00:02 -0500 Subject: [PATCH 17/18] pause screen polish shit --- source/ChartingState.hx | 63 ++++++++++++++++++++--------------------- source/CoolUtil.hx | 7 +++++ source/Paths.hx | 60 ++++++++++++++++++--------------------- source/PauseSubState.hx | 19 ++++++++++++- 4 files changed, 83 insertions(+), 66 deletions(-) diff --git a/source/ChartingState.hx b/source/ChartingState.hx index cc024ccff..64a0de8fb 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -1,8 +1,8 @@ package; +import Conductor.BPMChangeEvent; import Section.SwagSection; import Song.SwagSong; -import Conductor.BPMChangeEvent; import flixel.FlxG; import flixel.FlxSprite; import flixel.addons.display.FlxGridOverlay; @@ -447,21 +447,21 @@ class ChartingState extends MusicBeatState var updatedSection:Bool = false; /* this function got owned LOL - function lengthBpmBullshit():Float - { - if (_song.notes[curSection].changeBPM) - return _song.notes[curSection].lengthInSteps * (_song.notes[curSection].bpm / _song.bpm); - else - return _song.notes[curSection].lengthInSteps; + function lengthBpmBullshit():Float + { + if (_song.notes[curSection].changeBPM) + return _song.notes[curSection].lengthInSteps * (_song.notes[curSection].bpm / _song.bpm); + else + return _song.notes[curSection].lengthInSteps; }*/ - function sectionStartTime():Float { var daBPM:Int = _song.bpm; var daPos:Float = 0; for (i in 0...curSection) { - if (_song.notes[i].changeBPM) { + if (_song.notes[i].changeBPM) + { daBPM = _song.notes[i].bpm; } daPos += 4 * (1000 * 60 / daBPM); @@ -744,11 +744,11 @@ class ChartingState extends MusicBeatState vocals.pause(); /*var daNum:Int = 0; - var daLength:Float = 0; - while (daNum <= sec) - { - daLength += lengthBpmBullshit(); - daNum++; + var daLength:Float = 0; + while (daNum <= sec) + { + daLength += lengthBpmBullshit(); + daNum++; }*/ FlxG.sound.music.time = sectionStartTime(); @@ -830,7 +830,7 @@ class ChartingState extends MusicBeatState } else { - //get last bpm + // get last bpm var daBPM:Int = _song.bpm; for (i in 0...curSection) if (_song.notes[i].changeBPM) @@ -975,29 +975,28 @@ class ChartingState extends MusicBeatState } /* - function calculateSectionLengths(?sec:SwagSection):Int - { - var daLength:Int = 0; - - for (i in _song.notes) + function calculateSectionLengths(?sec:SwagSection):Int { - var swagLength = i.lengthInSteps; + var daLength:Int = 0; - if (i.typeOfSection == Section.COPYCAT) - swagLength * 2; - - daLength += swagLength; - - if (sec != null && sec == i) + for (i in _song.notes) { - trace('swag loop??'); - break; + var swagLength = i.lengthInSteps; + + if (i.typeOfSection == Section.COPYCAT) + swagLength * 2; + + daLength += swagLength; + + if (sec != null && sec == i) + { + trace('swag loop??'); + break; + } } - } - return daLength; + return daLength; }*/ - private var daSpacing:Float = 0.3; function loadLevel():Void diff --git a/source/CoolUtil.hx b/source/CoolUtil.hx index f49eeb071..8c24449bb 100644 --- a/source/CoolUtil.hx +++ b/source/CoolUtil.hx @@ -6,6 +6,13 @@ using StringTools; class CoolUtil { + public static var difficultyArray:Array = ['EASY', "NORMAL", "HARD"]; + + public static function difficultyString():String + { + return difficultyArray[PlayState.storyDifficulty]; + } + public static function coolTextFile(path:String):Array { var daList:Array = Assets.getText(path).trim().split('\n'); diff --git a/source/Paths.hx b/source/Paths.hx index 4bee419c5..dcd1477aa 100644 --- a/source/Paths.hx +++ b/source/Paths.hx @@ -1,123 +1,117 @@ package; -import openfl.utils.Assets as OpenFlAssets; -import openfl.utils.AssetType; - import flixel.FlxG; import flixel.graphics.frames.FlxAtlasFrames; +import openfl.utils.AssetType; +import openfl.utils.Assets as OpenFlAssets; class Paths { inline public static var SOUND_EXT = #if web "mp3" #else "ogg" #end; - + static var currentLevel:String; - + static public function setCurrentLevel(name:String) { currentLevel = name.toLowerCase(); } - + static function getPath(file:String, type:AssetType, library:Null) { if (library != null) return getLibraryPath(file, library); - + if (currentLevel != null) { var levelPath = getLibraryPathForce(file, currentLevel); if (OpenFlAssets.exists(levelPath, type)) return levelPath; - + levelPath = getLibraryPathForce(file, "shared"); if (OpenFlAssets.exists(levelPath, type)) return levelPath; } - + return getPreloadPath(file); } - + static public function getLibraryPath(file:String, library = "preload") { - return if (library == "preload" || library == "default") - getPreloadPath(file); - else - getLibraryPathForce(file, library); + return if (library == "preload" || library == "default") getPreloadPath(file); else getLibraryPathForce(file, library); } - + inline static function getLibraryPathForce(file:String, library:String) { - return '$library:assets/$library/$file'; } - + inline static function getPreloadPath(file:String) { - return 'assets/$file'; } - + inline static public function file(file:String, type:AssetType = TEXT, ?library:String) { return getPath(file, type, library); } - + inline static public function txt(key:String, ?library:String) { return getPath('data/$key.txt', TEXT, library); } - + inline static public function xml(key:String, ?library:String) { return getPath('data/$key.xml', TEXT, library); } - + inline static public function json(key:String, ?library:String) { return getPath('data/$key.json', TEXT, library); } - - static public function sound(key:String, ?library:String) + + static public function sound(key:String, ?library:String) { return getPath('sounds/$key.$SOUND_EXT', SOUND, library); } - + inline static public function soundRandom(key:String, min:Int, max:Int, ?library:String) { return sound(key + FlxG.random.int(min, max), library); } - + inline static public function music(key:String, ?library:String) { return getPath('music/$key.$SOUND_EXT', MUSIC, library); } - + inline static public function voices(song:String) { return 'songs:assets/songs/${song.toLowerCase()}/Voices.$SOUND_EXT'; } - + inline static public function inst(song:String) { return 'songs:assets/songs/${song.toLowerCase()}/Inst.$SOUND_EXT'; } - + inline static public function image(key:String, ?library:String) { return getPath('images/$key.png', IMAGE, library); } - + inline static public function font(key:String) { return 'assets/fonts/$key'; } - + inline static public function getSparrowAtlas(key:String, ?library:String) { return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library)); } - + inline static public function getPackerAtlas(key:String, ?library:String) { return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library)); } -} \ No newline at end of file +} diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx index 69bdf6007..5831ebef1 100644 --- a/source/PauseSubState.hx +++ b/source/PauseSubState.hx @@ -8,6 +8,9 @@ import flixel.addons.transition.FlxTransitionableState; import flixel.group.FlxGroup.FlxTypedGroup; import flixel.input.keyboard.FlxKey; import flixel.system.FlxSound; +import flixel.text.FlxText; +import flixel.tweens.FlxEase; +import flixel.tweens.FlxTween; import flixel.util.FlxColor; class PauseSubState extends MusicBeatSubstate @@ -30,10 +33,24 @@ class PauseSubState extends MusicBeatSubstate FlxG.sound.list.add(pauseMusic); var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); - bg.alpha = 0.6; + bg.alpha = 0; bg.scrollFactor.set(); add(bg); + var levelInfo:FlxText = new FlxText(20, 15, 0, "", 32); + levelInfo.text += PlayState.SONG.song; + levelInfo.text += '\n' + CoolUtil.difficultyString(); + levelInfo.scrollFactor.set(); + levelInfo.setFormat(Paths.font("vcr.ttf"), 32); + levelInfo.updateHitbox(); + add(levelInfo); + levelInfo.alpha = 0; + + levelInfo.x = FlxG.width - (levelInfo.width + 20); + + FlxTween.tween(bg, {alpha: 0.6}, 0.4, {ease: FlxEase.quartInOut}); + FlxTween.tween(levelInfo, {alpha: 1, y: 20}, 0.4, {ease: FlxEase.quartInOut, startDelay: 0.3}); + grpMenuShit = new FlxTypedGroup(); add(grpMenuShit); From 7cba3e72eac20b3fb597b8293eb5209d2757f185 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 1 Mar 2021 23:58:19 -0500 Subject: [PATCH 18/18] freeplay icon polish, and pause title touchups --- source/FreeplayState.hx | 12 ++++++++++++ source/PauseSubState.hx | 12 +++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 464ba7452..6dec6f1a6 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -28,6 +28,8 @@ class FreeplayState extends MusicBeatState private var grpSongs:FlxTypedGroup; private var curPlaying:Bool = false; + private var iconArray:Array = []; + override function create() { var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); @@ -88,6 +90,9 @@ class FreeplayState extends MusicBeatState var icon:HealthIcon = new HealthIcon(songs[i].songCharacter); icon.sprTracker = songText; + + // using a FlxGroup is too much fuss! + iconArray.push(icon); add(icon); // songText.x += 40; @@ -271,6 +276,13 @@ class FreeplayState extends MusicBeatState var bullShit:Int = 0; + for (i in 0...iconArray.length) + { + iconArray[i].alpha = 0.6; + } + + iconArray[curSelected].alpha = 1; + for (item in grpSongs.members) { item.targetY = bullShit - curSelected; diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx index 5831ebef1..2e36eda04 100644 --- a/source/PauseSubState.hx +++ b/source/PauseSubState.hx @@ -39,17 +39,27 @@ class PauseSubState extends MusicBeatSubstate var levelInfo:FlxText = new FlxText(20, 15, 0, "", 32); levelInfo.text += PlayState.SONG.song; - levelInfo.text += '\n' + CoolUtil.difficultyString(); levelInfo.scrollFactor.set(); levelInfo.setFormat(Paths.font("vcr.ttf"), 32); levelInfo.updateHitbox(); add(levelInfo); + + var levelDifficulty:FlxText = new FlxText(20, 15 + 32, 0, "", 32); + levelDifficulty.text += CoolUtil.difficultyString(); + levelDifficulty.scrollFactor.set(); + levelDifficulty.setFormat(Paths.font('vcr.ttf'), 32); + levelDifficulty.updateHitbox(); + add(levelDifficulty); + + levelDifficulty.alpha = 0; levelInfo.alpha = 0; levelInfo.x = FlxG.width - (levelInfo.width + 20); + levelDifficulty.x = FlxG.width - (levelDifficulty.width + 20); FlxTween.tween(bg, {alpha: 0.6}, 0.4, {ease: FlxEase.quartInOut}); FlxTween.tween(levelInfo, {alpha: 1, y: 20}, 0.4, {ease: FlxEase.quartInOut, startDelay: 0.3}); + FlxTween.tween(levelDifficulty, {alpha: 1, y: levelDifficulty.y + 5}, 0.4, {ease: FlxEase.quartInOut, startDelay: 0.5}); grpMenuShit = new FlxTypedGroup(); add(grpMenuShit);