1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-05-21 14:41:10 +00:00

Merge pull request #6 from ninjamuffin99/nitpix

aight yolo merge
This commit is contained in:
Cameron Taylor 2021-09-08 17:21:55 -04:00 committed by GitHub
commit 8e8b121663
8 changed files with 216 additions and 281 deletions

View file

@ -23,9 +23,6 @@ class Conductor
public static var lastSongPos:Float; public static var lastSongPos:Float;
public static var offset:Float = 0; public static var offset:Float = 0;
public static var safeFrames:Int = 10;
public static var safeZoneOffset:Float = (safeFrames / 60) * 1000; // is calculated in create(), is safeFrames in milliseconds
public static var bpmChangeMap:Array<BPMChangeEvent> = []; public static var bpmChangeMap:Array<BPMChangeEvent> = [];
public function new() public function new()

127
source/InitState.hx Normal file
View file

@ -0,0 +1,127 @@
package;
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
import flixel.addons.transition.FlxTransitionableState;
import flixel.addons.transition.TransitionData;
import flixel.graphics.FlxGraphic;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.util.FlxColor;
import openfl.display.BitmapData;
import ui.PreferencesMenu;
import ui.stageBuildShit.StageBuilderState;
#if colyseus
import io.colyseus.Client;
import io.colyseus.Room;
#end
#if discord_rpc
import Discord.DiscordClient;
#end
#if desktop
import sys.FileSystem;
import sys.io.File;
import sys.thread.Thread;
#end
using StringTools;
class InitState extends FlxTransitionableState
{
override public function create():Void
{
#if android
FlxG.android.preventDefaultKeys = [FlxAndroidKey.BACK];
#end
#if newgrounds
NGio.init();
#end
#if discord_rpc
DiscordClient.initialize();
Application.current.onExit.add(function(exitCode){
DiscordClient.shutdown();
});
#end
// ==== flixel shit ==== //
FlxG.debugger.addButton(LEFT, new BitmapData(200, 200), function(){
FlxG.debugger.visible = false;
});
FlxG.sound.muteKeys = [ZERO];
FlxG.game.focusLostFramerate = 60;
// FlxG.stage.window.borderless = true;
// FlxG.stage.window.mouseLock = true;
var diamond:FlxGraphic = FlxGraphic.fromClass(GraphicTransTileDiamond);
diamond.persist = true;
diamond.destroyOnNoUse = false;
FlxTransitionableState.defaultTransIn = new TransitionData(FADE, FlxColor.BLACK, 1, new FlxPoint(0, -1), {asset: diamond, width: 32, height: 32},
new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4));
FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 0.7, new FlxPoint(0, 1),
{asset: diamond, width: 32, height: 32}, new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4));
// ===== save shit ===== //
FlxG.save.bind('funkin', 'ninjamuffin99');
// https://github.com/HaxeFlixel/flixel/pull/2396
// IF/WHEN MY PR GOES THRU AND IT GETS INTO MAIN FLIXEL, DELETE THIS CHUNKOF CODE, AND THEN UNCOMMENT THE LINE BELOW
// FlxG.sound.loadSavedPrefs();
if (FlxG.save.data.volume != null)
FlxG.sound.volume = FlxG.save.data.volume;
if (FlxG.save.data.mute != null)
FlxG.sound.muted = FlxG.save.data.mute;
// FlxG.save.close();
// FlxG.sound.loadSavedPrefs();
PreferencesMenu.initPrefs();
PlayerSettings.init();
Highscore.load();
if (FlxG.save.data.weekUnlocked != null)
{
// FIX LATER!!!
// WEEK UNLOCK PROGRESSION!!
// StoryMenuState.weekUnlocked = FlxG.save.data.weekUnlocked;
if (StoryMenuState.weekUnlocked.length < 4)
StoryMenuState.weekUnlocked.insert(0, true);
// QUICK PATCH OOPS!
if (!StoryMenuState.weekUnlocked[0])
StoryMenuState.weekUnlocked[0] = true;
}
if (FlxG.save.data.seenVideo != null)
VideoState.seenVideo = FlxG.save.data.seenVideo;
// ===== fuck outta here ===== //
// FlxTransitionableState.skipNextTransOut = true;
FlxTransitionableState.skipNextTransIn = true;
#if FREEPLAY
FlxG.switchState(new FreeplayState());
#elseif ANIMATE
FlxG.switchState(new animate.AnimTestStage());
#elseif CHARTING
FlxG.switchState(new ChartingState());
#elseif STAGEBUILD
FlxG.switchState(new StageBuilderState());
#elseif ANIMDEBUG
FlxG.switchState(new ui.animDebugShit.DebugBoundingState());
#elseif NETTEST
FlxG.switchState(new netTest.NetTest());
#else
FlxG.sound.cache(Paths.music('freakyMenu'));
FlxG.switchState(new TitleState());
#end
}
}

View file

@ -19,7 +19,7 @@ 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 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 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 initialState:Class<FlxState> = InitState; // The FlxState the game starts with.
var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions. var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions.
#if web #if web
var framerate:Int = 60; // How many frames per second the game should run at. var framerate:Int = 60; // How many frames per second the game should run at.

View file

@ -34,7 +34,6 @@ class Note extends FlxSprite
public var isSustainNote:Bool = false; public var isSustainNote:Bool = false;
public var colorSwap:ColorSwap; public var colorSwap:ColorSwap;
public var noteScore:Float = 1;
public static var swagWidth:Float = 160 * 0.7; public static var swagWidth:Float = 160 * 0.7;
public static var PURP_NOTE:Int = 0; public static var PURP_NOTE:Int = 0;
@ -42,6 +41,15 @@ class Note extends FlxSprite
public static var BLUE_NOTE:Int = 1; public static var BLUE_NOTE:Int = 1;
public static var RED_NOTE:Int = 3; public static var RED_NOTE:Int = 3;
// SCORING STUFF
public static var safeFrames:Int = 10;
public static var HIT_WINDOW:Float = (safeFrames / 60) * 1000; // 166.67 ms hit window
// anything above bad threshold is shit
public static var BAD_THRESHOLD:Float = 0.8; // 125ms , 8 frames
public static var GOOD_THRESHOLD:Float = 0.55; // 91.67ms , 5.5 frames
public static var SICK_THRESHOLD:Float = 0.2; // 33.33ms , 2 frames
// anything below sick threshold is sick
public static var arrowColors:Array<Float> = [1, 1, 1, 1]; public static var arrowColors:Array<Float> = [1, 1, 1, 1];
public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false) public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false)
@ -145,7 +153,6 @@ class Note extends FlxSprite
if (isSustainNote && prevNote != null) if (isSustainNote && prevNote != null)
{ {
noteScore * 0.2;
alpha = 0.6; alpha = 0.6;
if (PreferencesMenu.getPref('downscroll')) if (PreferencesMenu.getPref('downscroll'))
@ -224,9 +231,9 @@ class Note extends FlxSprite
} }
else else
{ {
if (strumTime > Conductor.songPosition - Conductor.safeZoneOffset) if (strumTime > Conductor.songPosition - HIT_WINDOW)
{ // The * 0.5 is so that it's easier to hit them too late, instead of too early { // * 0.2 if sustain note, so u have to keep holding it closer to all the way thru!
if (strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.5)) if (strumTime < Conductor.songPosition + (HIT_WINDOW * (isSustainNote ? 0.2 : 1)))
canBeHit = true; canBeHit = true;
} }
else else

View file

@ -31,17 +31,12 @@ class NoteSplash extends FlxSprite
alpha = 0.6; alpha = 0.6;
animation.play('note' + noteData + '-' + FlxG.random.int(0, 1), true); animation.play('note' + noteData + '-' + FlxG.random.int(0, 1), true);
animation.curAnim.frameRate += FlxG.random.int(-2, 2); animation.curAnim.frameRate = 24 + FlxG.random.int(-2, 2);
animation.finishCallback = function(name){
kill();
};
updateHitbox(); updateHitbox();
offset.set(width * 0.3, height * 0.3); offset.set(width * 0.3, height * 0.3);
} }
override function update(elapsed:Float)
{
if (animation.curAnim.finished)
kill();
super.update(elapsed);
}
} }

View file

@ -25,12 +25,12 @@ class Paths
var levelPath = getLibraryPathForce(file, currentLevel); var levelPath = getLibraryPathForce(file, currentLevel);
if (OpenFlAssets.exists(levelPath, type)) if (OpenFlAssets.exists(levelPath, type))
return levelPath; return levelPath;
levelPath = getLibraryPathForce(file, "shared");
if (OpenFlAssets.exists(levelPath, type))
return levelPath;
} }
var levelPath = getLibraryPathForce(file, "shared");
if (OpenFlAssets.exists(levelPath, type))
return levelPath;
return getPreloadPath(file); return getPreloadPath(file);
} }

View file

@ -1770,7 +1770,7 @@ class PlayState extends MusicBeatState
if (vocalsFinished) if (vocalsFinished)
return; return;
vocals.time = Conductor.songPosition; vocals.time = FlxG.sound.music.time;
vocals.play(); vocals.play();
} }
@ -1780,9 +1780,6 @@ class PlayState extends MusicBeatState
override public function update(elapsed:Float) override public function update(elapsed:Float)
{ {
// makes the lerp non-dependant on the framerate
// FlxG.camera.followLerp = CoolUtil.camLerpShit(0.04);
#if !debug #if !debug
perfectMode = false; perfectMode = false;
#else #else
@ -1873,6 +1870,7 @@ class PlayState extends MusicBeatState
paused = true; paused = true;
// 1 / 1000 chance for Gitaroo Man easter egg // 1 / 1000 chance for Gitaroo Man easter egg
// can this please move to dying it's kinda fucked up that pausing has a 1/1000 chance ur forced to restart
if (FlxG.random.bool(0.1)) if (FlxG.random.bool(0.1))
{ {
// gitaroo man easter egg // gitaroo man easter egg
@ -1904,9 +1902,6 @@ class PlayState extends MusicBeatState
if (FlxG.keys.justPressed.NINE) if (FlxG.keys.justPressed.NINE)
iconP1.swapOldIcon(); iconP1.swapOldIcon();
// FlxG.watch.addQuick('VOL', vocals.amplitudeLeft);
// FlxG.watch.addQuick('VOLRight', vocals.amplitudeRight);
iconP1.setGraphicSize(Std.int(CoolUtil.coolLerp(iconP1.width, 150, 0.15))); iconP1.setGraphicSize(Std.int(CoolUtil.coolLerp(iconP1.width, 150, 0.15)));
iconP2.setGraphicSize(Std.int(CoolUtil.coolLerp(iconP2.width, 150, 0.15))); iconP2.setGraphicSize(Std.int(CoolUtil.coolLerp(iconP2.width, 150, 0.15)));
@ -1973,24 +1968,9 @@ class PlayState extends MusicBeatState
gfSpeed = 2; gfSpeed = 2;
case 112: case 112:
gfSpeed = 1; gfSpeed = 1;
case 163:
// FlxG.sound.music.stop();
// FlxG.switchState(new TitleState());
} }
} }
if (curSong == 'Bopeebo')
{
switch (curBeat)
{
case 128, 129, 130:
vocals.volume = 0;
// FlxG.sound.music.stop();
// FlxG.switchState(new PlayState());
}
}
// better streaming of shit
if (!inCutscene && !_exiting) if (!inCutscene && !_exiting)
{ {
// RESET = Quick Game Over Screen // RESET = Quick Game Over Screen
@ -2223,6 +2203,7 @@ class PlayState extends MusicBeatState
daPos += 4 * (1000 * 60 / daBPM); daPos += 4 * (1000 * 60 / daBPM);
} }
Conductor.songPosition = FlxG.sound.music.time = daPos; Conductor.songPosition = FlxG.sound.music.time = daPos;
Conductor.songPosition += Conductor.offset;
updateCurStep(); updateCurStep();
resyncVocals(); resyncVocals();
} }
@ -2339,19 +2320,19 @@ class PlayState extends MusicBeatState
var isSick:Bool = true; var isSick:Bool = true;
if (noteDiff > Conductor.safeZoneOffset * 0.9) if (noteDiff > Note.HIT_WINDOW * Note.BAD_THRESHOLD)
{ {
daRating = 'shit'; daRating = 'shit';
score = 50; score = 50;
isSick = false; // shitty copypaste on this literally just because im lazy and tired lol! isSick = false; // shitty copypaste on this literally just because im lazy and tired lol!
} }
else if (noteDiff > Conductor.safeZoneOffset * 0.75) else if (noteDiff > Note.HIT_WINDOW * Note.GOOD_THRESHOLD)
{ {
daRating = 'bad'; daRating = 'bad';
score = 100; score = 100;
isSick = false; isSick = false;
} }
else if (noteDiff > Conductor.safeZoneOffset * 0.2) else if (noteDiff > Note.HIT_WINDOW * Note.SICK_THRESHOLD)
{ {
daRating = 'good'; daRating = 'good';
score = 200; score = 200;
@ -2963,11 +2944,6 @@ class PlayState extends MusicBeatState
{ {
resyncVocals(); resyncVocals();
} }
if (dad.curCharacter == 'spooky' && curStep % 4 == 2)
{
// dad.dance();
}
} }
var lightningStrikeBeat:Int = 0; var lightningStrikeBeat:Int = 0;

View file

@ -1,12 +1,8 @@
package; package;
import flixel.FlxGame;
import flixel.FlxObject; import flixel.FlxObject;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond; import flixel.FlxState;
import flixel.addons.transition.FlxTransitionableState;
import flixel.addons.transition.TransitionData;
import flixel.graphics.FlxGraphic;
import flixel.group.FlxGroup; import flixel.group.FlxGroup;
import flixel.input.android.FlxAndroidKey; import flixel.input.android.FlxAndroidKey;
import flixel.input.android.FlxAndroidKeys; import flixel.input.android.FlxAndroidKeys;
@ -14,8 +10,6 @@ import flixel.input.gamepad.FlxGamepad;
import flixel.input.gamepad.id.SwitchJoyconLeftID; import flixel.input.gamepad.id.SwitchJoyconLeftID;
import flixel.math.FlxPoint; import flixel.math.FlxPoint;
import flixel.math.FlxRect; import flixel.math.FlxRect;
import flixel.system.FlxAssets.FlxGraphicAsset;
import flixel.system.FlxAssets;
import flixel.text.FlxText; import flixel.text.FlxText;
import flixel.tweens.FlxEase; import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween; import flixel.tweens.FlxTween;
@ -26,32 +20,21 @@ import lime.graphics.Image;
import lime.media.AudioContext; import lime.media.AudioContext;
import lime.ui.Window; import lime.ui.Window;
import openfl.Assets; import openfl.Assets;
import openfl.display.BitmapData;
import openfl.display.Sprite; import openfl.display.Sprite;
import openfl.events.AsyncErrorEvent; import openfl.events.AsyncErrorEvent;
import openfl.events.AsyncErrorEvent;
import openfl.events.Event; import openfl.events.Event;
import openfl.events.MouseEvent; import openfl.events.MouseEvent;
import openfl.events.NetStatusEvent; import openfl.events.NetStatusEvent;
import openfl.media.Video; import openfl.media.Video;
import openfl.net.NetConnection; import openfl.net.NetConnection;
import openfl.net.NetStream; import openfl.net.NetStream;
import shaderslmfao.BuildingShaders.BuildingShader;
import shaderslmfao.BuildingShaders; import shaderslmfao.BuildingShaders;
import shaderslmfao.ColorSwap; import shaderslmfao.ColorSwap;
import shaderslmfao.TitleOutline; import shaderslmfao.TitleOutline;
import ui.PreferencesMenu; import ui.PreferencesMenu;
import ui.stageBuildShit.StageBuilderState;
using StringTools; using StringTools;
#if colyseus
import io.colyseus.Client;
import io.colyseus.Room;
#end
#if discord_rpc
import Discord.DiscordClient;
#end
#if desktop #if desktop
import sys.FileSystem; import sys.FileSystem;
import sys.io.File; import sys.io.File;
@ -62,20 +45,15 @@ class TitleState extends MusicBeatState
{ {
public static var initialized:Bool = false; public static var initialized:Bool = false;
var startedIntro:Bool;
var blackScreen:FlxSprite; var blackScreen:FlxSprite;
var credGroup:FlxGroup; var credGroup:FlxGroup;
var credTextShit:Alphabet;
var textGroup:FlxGroup; var textGroup:FlxGroup;
var ngSpr:FlxSprite; var ngSpr:FlxSprite;
var curWacky:Array<String> = []; var curWacky:Array<String> = [];
var wackyImage:FlxSprite;
var lastBeat:Int = 0; var lastBeat:Int = 0;
var swagShader:ColorSwap; var swagShader:ColorSwap;
var alphaShader:BuildingShaders; var alphaShader:BuildingShaders;
var thingie:FlxSprite;
var video:Video; var video:Video;
var netStream:NetStream; var netStream:NetStream;
@ -83,24 +61,9 @@ class TitleState extends MusicBeatState
override public function create():Void override public function create():Void
{ {
#if android
FlxG.android.preventDefaultKeys = [FlxAndroidKey.BACK];
#end
FlxG.debugger.addButton(LEFT, new BitmapData(200, 200), function()
{
FlxG.debugger.visible = false;
});
startedIntro = false;
FlxG.game.focusLostFramerate = 60;
swagShader = new ColorSwap(); swagShader = new ColorSwap();
alphaShader = new BuildingShaders(); alphaShader = new BuildingShaders();
FlxG.sound.muteKeys = [ZERO];
curWacky = FlxG.random.getObject(getIntroTextShit()); curWacky = FlxG.random.getObject(getIntroTextShit());
FlxG.sound.cache(Paths.music('freakyMenu')); FlxG.sound.cache(Paths.music('freakyMenu'));
@ -108,57 +71,6 @@ class TitleState extends MusicBeatState
super.create(); super.create();
FlxG.save.bind('funkin', 'ninjamuffin99');
// https://github.com/HaxeFlixel/flixel/pull/2396
// IF/WHEN MY PR GOES THRU AND IT GETS INTO MAIN FLIXEL, DELETE THIS CHUNKOF CODE, AND THEN UNCOMMENT THE LINE BELOW
// FlxG.sound.loadSavedPrefs();
if (FlxG.save.data.volume != null)
{
FlxG.sound.volume = FlxG.save.data.volume;
}
if (FlxG.save.data.mute != null)
{
FlxG.sound.muted = FlxG.save.data.mute;
}
// FlxG.save.close();
// FlxG.sound.loadSavedPrefs();
PreferencesMenu.initPrefs();
PlayerSettings.init();
Highscore.load();
#if newgrounds
NGio.init();
#end
if (FlxG.save.data.weekUnlocked != null)
{
// FIX LATER!!!
// WEEK UNLOCK PROGRESSION!!
// StoryMenuState.weekUnlocked = FlxG.save.data.weekUnlocked;
if (StoryMenuState.weekUnlocked.length < 4)
StoryMenuState.weekUnlocked.insert(0, true);
// QUICK PATCH OOPS!
if (!StoryMenuState.weekUnlocked[0])
StoryMenuState.weekUnlocked[0] = true;
}
if (FlxG.save.data.seenVideo != null)
{
VideoState.seenVideo = FlxG.save.data.seenVideo;
}
#if FREEPLAY
FlxG.switchState(new FreeplayState());
#elseif ANIMATE
FlxG.switchState(new animate.AnimTestStage());
#elseif CHARTING
FlxG.switchState(new ChartingState());
/* /*
#elseif web #elseif web
@ -190,30 +102,10 @@ class TitleState extends MusicBeatState
*/ */
// netConnection.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown); // netConnection.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown);
#elseif STAGEBUILD
FlxG.switchState(new StageBuilderState());
#elseif ANIMDEBUG
FlxG.switchState(new ui.animDebugShit.DebugBoundingState());
#elseif NETTEST
FlxG.switchState(new netTest.NetTest());
#else
new FlxTimer().start(1, function(tmr:FlxTimer) new FlxTimer().start(1, function(tmr:FlxTimer)
{ {
startIntro(); startIntro();
}); });
#end
#if discord_rpc
DiscordClient.initialize();
Application.current.onExit.add(function(exitCode)
{
DiscordClient.shutdown();
});
#end
// FlxG.stage.window.borderless = true;
// FlxG.stage.window.mouseLock = true;
} }
private function client_onMetaData(metaData:Dynamic) private function client_onMetaData(metaData:Dynamic)
@ -261,18 +153,6 @@ class TitleState extends MusicBeatState
function startIntro() function startIntro()
{ {
if (!initialized)
{
var diamond:FlxGraphic = FlxGraphic.fromClass(GraphicTransTileDiamond);
diamond.persist = true;
diamond.destroyOnNoUse = false;
FlxTransitionableState.defaultTransIn = new TransitionData(FADE, FlxColor.BLACK, 1, new FlxPoint(0, -1), {asset: diamond, width: 32, height: 32},
new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4));
FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 0.7, new FlxPoint(0, 1),
{asset: diamond, width: 32, height: 32}, new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4));
}
if (FlxG.sound.music == null || !FlxG.sound.music.playing) if (FlxG.sound.music == null || !FlxG.sound.music.playing)
{ {
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0); FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
@ -283,10 +163,6 @@ class TitleState extends MusicBeatState
persistentUpdate = true; persistentUpdate = true;
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
// bg.antialiasing = true;
// bg.setGraphicSize(Std.int(bg.width * 0.6));
// bg.updateHitbox();
add(bg); add(bg);
logoBl = new FlxSprite(-150, -100); logoBl = new FlxSprite(-150, -100);
@ -334,34 +210,18 @@ class TitleState extends MusicBeatState
// titleText.screenCenter(X); // titleText.screenCenter(X);
add(titleText); add(titleText);
var logo:FlxSprite = new FlxSprite().loadGraphic(Paths.image('logo'));
logo.screenCenter();
logo.antialiasing = true;
// add(logo);
// FlxTween.tween(logoBl, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG});
// FlxTween.tween(logo, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG, startDelay: 0.1});
var animShit:ComboCounter = new ComboCounter(200, 200, 1423);
// add(animShit);
credGroup = new FlxGroup(); credGroup = new FlxGroup();
add(credGroup); add(credGroup);
textGroup = new FlxGroup(); textGroup = new FlxGroup();
blackScreen = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); blackScreen = bg.clone();
credGroup.add(blackScreen); credGroup.add(blackScreen);
// var atlasBullShit:FlxSprite = new FlxSprite(); // var atlasBullShit:FlxSprite = new FlxSprite();
// atlasBullShit.frames = CoolUtil.fromAnimate(Paths.image('money'), Paths.file('images/money.json')); // atlasBullShit.frames = CoolUtil.fromAnimate(Paths.image('money'), Paths.file('images/money.json'));
// credGroup.add(atlasBullShit); // credGroup.add(atlasBullShit);
credTextShit = new Alphabet(0, 0, "ninjamuffin99\nPhantomArcade\nkawaisprite\nevilsk8er", true);
credTextShit.screenCenter();
// credTextShit.alignment = CENTER;
credTextShit.visible = false;
ngSpr = new FlxSprite(0, FlxG.height * 0.52); ngSpr = new FlxSprite(0, FlxG.height * 0.52);
if (FlxG.random.bool(1)) if (FlxG.random.bool(1))
@ -388,8 +248,6 @@ class TitleState extends MusicBeatState
ngSpr.screenCenter(X); ngSpr.screenCenter(X);
ngSpr.antialiasing = true; ngSpr.antialiasing = true;
FlxTween.tween(credTextShit, {y: credTextShit.y + 20}, 2.9, {ease: FlxEase.quadInOut, type: PINGPONG});
FlxG.mouse.visible = false; FlxG.mouse.visible = false;
if (initialized) if (initialized)
@ -399,9 +257,6 @@ class TitleState extends MusicBeatState
if (FlxG.sound.music != null) if (FlxG.sound.music != null)
FlxG.sound.music.onComplete = function() FlxG.switchState(new VideoState()); FlxG.sound.music.onComplete = function() FlxG.switchState(new VideoState());
startedIntro = true;
// credGroup.add(credTextShit);
} }
function getIntroTextShit():Array<Array<String>> function getIntroTextShit():Array<Array<String>>
@ -421,9 +276,6 @@ class TitleState extends MusicBeatState
var transitioning:Bool = false; var transitioning:Bool = false;
var fnfShit:String = "Friday Night Funkin'";
var thingOffset:Int = 0;
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
/* if (FlxG.onMobile) /* if (FlxG.onMobile)
@ -501,9 +353,10 @@ class TitleState extends MusicBeatState
if (FlxG.sound.music != null) if (FlxG.sound.music != null)
Conductor.songPosition = FlxG.sound.music.time; Conductor.songPosition = FlxG.sound.music.time;
// FlxG.watch.addQuick('amp', FlxG.sound.music.amplitude);
if (FlxG.keys.justPressed.F) if (FlxG.keys.justPressed.F)
FlxG.fullscreen = !FlxG.fullscreen; FlxG.fullscreen = !FlxG.fullscreen;
// do controls.PAUSE | controls.ACCEPT instead?
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER; var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;
if (FlxG.onMobile) if (FlxG.onMobile)
@ -542,13 +395,8 @@ class TitleState extends MusicBeatState
FlxG.camera.flash(FlxColor.WHITE, 1); FlxG.camera.flash(FlxColor.WHITE, 1);
FlxG.sound.play(Paths.sound('confirmMenu'), 0.7); FlxG.sound.play(Paths.sound('confirmMenu'), 0.7);
transitioning = true; transitioning = true;
// FlxG.sound.music.stop();
// These assets are very unlikely to be used for the rest of gameplay, so it unloads them from cache/memory var targetState:FlxState = new MainMenuState();
// Saves about 50mb of RAM or so???
Assets.cache.clear(Paths.image('gfDanceTitle'));
Assets.cache.clear(Paths.image('logoBumpin'));
Assets.cache.clear(Paths.image('titleEnter'));
#if newgrounds #if newgrounds
if (!OutdatedSubState.leftState) if (!OutdatedSubState.leftState)
@ -561,19 +409,26 @@ class TitleState extends MusicBeatState
if (version.trim() != onlineVersion) if (version.trim() != onlineVersion)
{ {
trace('OLD VERSION!'); trace('OLD VERSION!');
// FlxG.switchState(new OutdatedSubState()); // targetState = new OutdatedSubState();
} }
else else
{ {
// FlxG.switchState(new MainMenuState()); // targetState = new MainMenuState();
} }
// REDO FOR ITCH/FINAL SHIT // REDO FOR ITCH/FINAL SHIT
FlxG.switchState(new MainMenuState());
}); });
} }
#else
FlxG.switchState(new MainMenuState());
#end #end
new FlxTimer().start(2, function(tmr:FlxTimer)
{
// These assets are very unlikely to be used for the rest of gameplay, so it unloads them from cache/memory
// Saves about 50mb of RAM or so???
Assets.cache.clear(Paths.image('gfDanceTitle'));
Assets.cache.clear(Paths.image('logoBumpin'));
Assets.cache.clear(Paths.image('titleEnter'));
// ngSpr??
FlxG.switchState(targetState);
});
// FlxG.sound.play(Paths.music('titleShoot'), 0.7); // FlxG.sound.play(Paths.music('titleShoot'), 0.7);
} }
if (pressedEnter && !skippedIntro && initialized) if (pressedEnter && !skippedIntro && initialized)
@ -591,8 +446,6 @@ class TitleState extends MusicBeatState
#end #end
*/ */
// if (FlxG.keys.justPressed.SPACE)
// swagShader.hasOutline = !swagShader.hasOutline;
if (controls.UI_LEFT) if (controls.UI_LEFT)
swagShader.update(-elapsed * 0.1); swagShader.update(-elapsed * 0.1);
if (controls.UI_RIGHT) if (controls.UI_RIGHT)
@ -678,11 +531,56 @@ class TitleState extends MusicBeatState
} }
var isRainbow:Bool = false; var isRainbow:Bool = false;
var skippedIntro:Bool = false;
override function beatHit() override function beatHit()
{ {
super.beatHit(); super.beatHit();
if (!skippedIntro)
{
FlxG.log.add(curBeat);
// if the user is draggin the window some beats will
// be missed so this is just to compensate
if (curBeat > lastBeat)
{
for (i in lastBeat...curBeat)
{
switch (i + 1)
{
case 1:
createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']);
case 3:
addMoreText('present');
case 4:
deleteCoolText();
case 5:
createCoolText(['In association', 'with']);
case 7:
addMoreText('newgrounds');
ngSpr.visible = true;
case 8:
deleteCoolText();
ngSpr.visible = false;
case 9:
createCoolText([curWacky[0]]);
case 11:
addMoreText(curWacky[1]);
case 12:
deleteCoolText();
case 13:
addMoreText('Friday');
case 14:
addMoreText('Night');
case 15:
addMoreText('Funkin');
case 16:
skipIntro();
}
}
}
lastBeat = curBeat;
}
if (skippedIntro) if (skippedIntro)
{ {
if (cheatActive && curBeat % 2 == 0) if (cheatActive && curBeat % 2 == 0)
@ -697,73 +595,8 @@ class TitleState extends MusicBeatState
else else
gfDance.animation.play('danceLeft'); gfDance.animation.play('danceLeft');
} }
else
{
FlxG.log.add(curBeat);
// if the user is draggin the window some beats will
// be missed so this is just to compensate
if (curBeat > lastBeat)
{
for (i in lastBeat...curBeat)
{
switch (i + 1)
{
case 1:
createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']);
// credTextShit.visible = true;
case 3:
addMoreText('present');
// credTextShit.text += '\npresent...';
// credTextShit.addText();
case 4:
deleteCoolText();
// credTextShit.visible = false;
// credTextShit.text = 'In association \nwith';
// credTextShit.screenCenter();
case 5:
createCoolText(['In association', 'with']);
case 7:
addMoreText('newgrounds');
ngSpr.visible = true;
// credTextShit.text += '\nNewgrounds';
case 8:
deleteCoolText();
ngSpr.visible = false;
// credTextShit.visible = false;
// credTextShit.text = 'Shoutouts Tom Fulp';
// credTextShit.screenCenter();
case 9:
createCoolText([curWacky[0]]);
// credTextShit.visible = true;
case 11:
addMoreText(curWacky[1]);
// credTextShit.text += '\nlmao';
case 12:
deleteCoolText();
// credTextShit.visible = false;
// credTextShit.text = "Friday";
// credTextShit.screenCenter();
case 13:
addMoreText('Friday');
// credTextShit.visible = true;
case 14:
addMoreText('Night');
// credTextShit.text += '\nNight';
case 15:
addMoreText('Funkin'); // credTextShit.text += '\nFunkin';
case 16:
skipIntro();
}
}
}
lastBeat = curBeat;
}
} }
var skippedIntro:Bool = false;
function skipIntro():Void function skipIntro():Void
{ {
if (!skippedIntro) if (!skippedIntro)