1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-03-23 18:39:33 +00:00

Merge branch 'master' into ng_login

This commit is contained in:
George FunBook 2021-03-13 20:24:57 -06:00
commit 95f8d65972
20 changed files with 521 additions and 287 deletions

View file

@ -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.

View file

@ -2,7 +2,7 @@
<project>
<!-- _________________________ Application Settings _________________________ -->
<app title="Friday Night Funkin'" file="Funkin" packageName="com.ninjamuffin99.funkin" main="Main" version="0.2.7.1" company="ninjamuffin99" />
<app title="Friday Night Funkin'" file="Funkin" packageName="com.ninjamuffin99.funkin" package="com.ninjamuffin99.funkin" main="Main" version="0.2.7.1" company="ninjamuffin99" />
<!--Switch Export with Unique ApplicationID and Icon-->
<set name="APP_ID" value="0x0100f6c013bbc000" />
@ -18,7 +18,7 @@
<!-- ____________________________ Window Settings ___________________________ -->
<!--These window settings apply to all targets-->
<window width="1280" height="720" fps="60" background="#000000" hardware="true" vsync="false" />
<window width="1280" height="720" fps="" background="#000000" hardware="true" vsync="false" />
<!--HTML5-specific-->
<window if="html5" resizable="true" />
@ -27,7 +27,7 @@
<window if="desktop" orientation="landscape" fullscreen="false" resizable="true" vsync="false"/>
<!--Mobile-specific-->
<window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" />
<window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" resizable="false"/>
<!--Switch-specific-->
<window if="switch" orientation="landscape" fullscreen="true" width="0" height="0" resizable="true" />
@ -136,9 +136,9 @@
<!--<haxedef name="FLX_NO_NATIVE_CURSOR" />-->
<!--Optimise inputs, be careful you will get null errors if you don't use conditionals in your game-->
<haxedef name="FLX_NO_MOUSE" if="mobile" />
<haxedef name="FLX_NO_KEYBOARD" if="mobile" />
<haxedef name="FLX_NO_TOUCH" if="desktop" />
<!-- <haxedef name="FLX_NO_MOUSE" if="mobile" /> -->
<!-- <haxedef name="FLX_NO_KEYBOARD" if="mobile" /> -->
<!-- <haxedef name="FLX_NO_TOUCH" if="desktop" /> -->
<!--<haxedef name="FLX_NO_GAMEPAD" />-->
<!--Disable the Flixel core sound tray-->
@ -163,6 +163,7 @@
<icon path="art/icon16.png" size='16'/>
<icon path="art/icon32.png" size='32'/>
<icon path="art/icon64.png" size='64'/>
<icon path="art/iconOG.png" />
<!-- <haxedef name="SKIP_TO_PLAYSTATE" if="debug" /> -->

191
README.md
View file

@ -1,93 +1,98 @@
# 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. Below is a version of APIStuff that points at a debug NG project for the game.
Just make a file in `/source` and call it `APIStuff.hx`, and copy paste this into it
```haxe
package;
class APIStuff
{
inline public static var API:String = "51348:TtzK0rZ8";
inline public static var EncKey:String = "5NqKsSVSNKHbF9fPgZPqPg==";
inline public static var SESSION:String = null;
}
```
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 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. Currently, these are all of the things you need to install:
```
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 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!
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
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
{
inline public static var API:String = "51348:TtzK0rZ8";
inline public static var EncKey:String = "5NqKsSVSNKHbF9fPgZPqPg==";
inline public static var SESSION:String = null;
}
```
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)

View file

@ -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<String, Array<Dynamic>>();
super(x, y);
animOffsets = new Map<String, Array<Dynamic>>();
curCharacter = character;
this.isPlayer = isPlayer;
@ -622,8 +623,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]);
}

View file

@ -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

View file

@ -1,5 +1,6 @@
package;
import flixel.FlxSprite;
import flixel.FlxSubState;
class ControlsSubState extends FlxSubState

View file

@ -6,6 +6,13 @@ using StringTools;
class CoolUtil
{
public static var difficultyArray:Array<String> = ['EASY', "NORMAL", "HARD"];
public static function difficultyString():String
{
return difficultyArray[PlayState.storyDifficulty];
}
public static function coolTextFile(path:String):Array<String>
{
var daList:Array<String> = Assets.getText(path).trim().split('\n');

View file

@ -14,7 +14,7 @@ using StringTools;
class FreeplayState extends MusicBeatState
{
var songs:Array<String> = [];
var songs:Array<SongMetadata> = [];
var selector:FlxText;
var curSelected:Int = 0;
@ -28,9 +28,16 @@ class FreeplayState extends MusicBeatState
private var grpSongs:FlxTypedGroup<Alphabet>;
private var curPlaying:Bool = false;
private var iconArray:Array<HealthIcon> = [];
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, 'gf'));
}
/*
if (FlxG.sound.music != null)
@ -47,39 +54,22 @@ class FreeplayState extends MusicBeatState
#end
if (StoryMenuState.weekUnlocked[2] || isDebug)
{
songs.push('Spookeez');
songs.push('South');
}
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);
if (StoryMenuState.weekUnlocked[2] || isDebug)
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']);
if (StoryMenuState.weekUnlocked[3] || isDebug)
{
songs.push('Pico');
songs.push('Philly');
songs.push('Blammed');
}
addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);
if (StoryMenuState.weekUnlocked[4] || isDebug)
{
songs.push('Satin-Panties');
songs.push('High');
songs.push('Milf');
}
addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']);
if (StoryMenuState.weekUnlocked[5] || isDebug)
{
songs.push('Cocoa');
songs.push('Eggnog');
songs.push('Winter-Horrorland');
}
addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']);
if (StoryMenuState.weekUnlocked[6] || isDebug)
{
songs.push('Senpai');
songs.push('Roses');
songs.push('Thorns');
// songs.push('Winter-Horrorland');
}
addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);
// LOAD MUSIC
@ -93,10 +83,18 @@ 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);
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;
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
// songText.screenCenter(X);
@ -150,6 +148,26 @@ class FreeplayState extends MusicBeatState
super.create();
}
public function addSong(songName:String, weekNum:Int, songCharacter:String)
{
songs.push(new SongMetadata(songName, weekNum, songCharacter));
}
public function addWeek(songs:Array<String>, weekNum:Int, ?songCharacters:Array<String>)
{
if (songCharacters == null)
songCharacters = ['bf'];
var num:Int = 0;
for (song in songs)
{
addSong(song, weekNum, songCharacters[num]);
if (songCharacters.length != 1)
num++;
}
}
override function update(elapsed:Float)
{
super.update(elapsed);
@ -191,13 +209,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;
PlayState.storyWeek = songs[curSelected].week;
trace('CUR WEEK' + PlayState.storyWeek);
LoadingState.loadAndSwitchState(new PlayState());
}
}
@ -211,7 +232,7 @@ class FreeplayState extends MusicBeatState
if (curDifficulty > 2)
curDifficulty = 0;
intendedScore = Highscore.getScore(songs[curSelected], curDifficulty);
intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
switch (curDifficulty)
{
@ -240,15 +261,22 @@ class FreeplayState extends MusicBeatState
// selector.y = (70 * curSelected) + 30;
intendedScore = Highscore.getScore(songs[curSelected], curDifficulty);
intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
// lerpScore = 0;
#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;
for (i in 0...iconArray.length)
{
iconArray[i].alpha = 0.6;
}
iconArray[curSelected].alpha = 1;
for (item in grpSongs.members)
{
item.targetY = bullShit - curSelected;
@ -265,3 +293,17 @@ class FreeplayState extends MusicBeatState
}
}
}
class SongMetadata
{
public var songName:String = "";
public var week:Int = 0;
public var songCharacter:String = "";
public function new(song:String, week:Int, songCharacter:String)
{
this.songName = song;
this.week = week;
this.songCharacter = songCharacter;
}
}

View file

@ -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);
}
}

View file

@ -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<FlxState> = 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));

View file

@ -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;
}
}

View file

@ -173,16 +173,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
@ -190,9 +188,7 @@ class Note extends FlxSprite
canBeHit = false;
if (strumTime <= Conductor.songPosition)
{
wasGoodHit = true;
}
}
if (tooLate)

6
source/Options.hx Normal file
View file

@ -0,0 +1,6 @@
package;
class Options
{
public static var masterVolume:Float = 1;
}

View file

@ -32,44 +32,50 @@ class OptionsMenu_old extends MusicBeatState
menuBG.antialiasing = true;
add(menuBG);
grpControls = new FlxTypedGroup<Alphabet>();
add(grpControls);
/*
grpControls = new FlxTypedGroup<Alphabet>();
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

View file

@ -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<String> = ['Master Volume', 'Sound Volume'];
var textMenuItems:Array<String> = ['Master Volume', 'Sound Volume', 'Controls'];
var selector:FlxSprite;
var curSelected:Int = 0;
var grpOptionsTexts:FlxTypedGroup<FlxText>;
public function new()
{
super();
grpOptionsTexts = new FlxTypedGroup<FlxText>();
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());
}
}
}
}

View file

@ -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<String>)
{
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));
}
}
}

View file

@ -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,34 @@ 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.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<Alphabet>();
add(grpMenuShit);

View file

@ -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();
@ -1274,7 +1278,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)
@ -1473,14 +1484,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));
}
@ -1566,27 +1570,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();
}
});
}
@ -1865,7 +1860,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);
@ -1941,13 +1936,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
{
@ -2232,12 +2229,9 @@ class PlayState extends MusicBeatState
override function stepHit()
{
super.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' && curStep % 4 == 2)

View file

@ -22,7 +22,7 @@ class StoryMenuState extends MusicBeatState
var weekData:Array<Dynamic> = [
['Tutorial'],
['Bopeebo', 'Fresh', 'Dadbattle'],
['Spookeez', 'South'],
['Spookeez', 'South', "Monster"],
['Pico', 'Philly', "Blammed"],
['Satin-Panties', "High", "Milf"],
['Cocoa', 'Eggnog', 'Winter-Horrorland'],
@ -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;
}

View file

@ -228,6 +228,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)