diff --git a/source/GameOverSubstate.hx b/source/GameOverSubstate.hx index fd082d21e..c427e140d 100644 --- a/source/GameOverSubstate.hx +++ b/source/GameOverSubstate.hx @@ -7,6 +7,7 @@ import flixel.math.FlxPoint; import flixel.util.FlxColor; import flixel.util.FlxTimer; import haxe.display.Display.Package; +import ui.PreferencesMenu; class GameOverSubstate extends MusicBeatSubstate { @@ -60,7 +61,12 @@ class GameOverSubstate extends MusicBeatSubstate bf.playAnim('firstDeath'); - randomGameover = FlxG.random.int(1, 25); + var randomCensor:Array = []; + + if (PreferencesMenu.getPref('censor-naughty')) + randomCensor = [1, 3, 8, 13, 17, 21]; + + randomGameover = FlxG.random.int(1, 25, randomCensor); } var playingDeathSound:Bool = false; @@ -76,6 +82,8 @@ class GameOverSubstate extends MusicBeatSubstate if (controls.BACK) { + PlayState.deathCounter = 0; + PlayState.seenCutscene = false; FlxG.sound.music.stop(); if (PlayState.isStoryMode) diff --git a/source/LoadingState.hx b/source/LoadingState.hx index dcb4b1d8e..2c520ea0d 100644 --- a/source/LoadingState.hx +++ b/source/LoadingState.hx @@ -4,6 +4,7 @@ import flixel.FlxG; import flixel.FlxSprite; import flixel.FlxState; import flixel.graphics.frames.FlxAtlasFrames; +import flixel.math.FlxMath; import flixel.util.FlxTimer; import haxe.io.Path; import lime.app.Future; @@ -21,10 +22,10 @@ class LoadingState extends MusicBeatState var stopMusic = false; var callbacks:MultiCallback; - var logo:FlxSprite; - var gfDance:FlxSprite; var danceLeft = false; + var loadBar:FlxSprite; + function new(target:FlxState, stopMusic:Bool) { super(); @@ -46,6 +47,10 @@ class LoadingState extends MusicBeatState funkay.scrollFactor.set(); funkay.screenCenter(); + loadBar = new FlxSprite(0, FlxG.height - 20).makeGraphic(FlxG.width, 10, 0xFFff16d2); + loadBar.screenCenter(X); + add(loadBar); + initSongsManifest().onComplete(function(lib) { callbacks = new MultiCallback(onLoad); @@ -104,18 +109,29 @@ class LoadingState extends MusicBeatState { super.beatHit(); - logo.animation.play('bump'); + // logo.animation.play('bump'); danceLeft = !danceLeft; - - if (danceLeft) - gfDance.animation.play('danceRight'); - else - gfDance.animation.play('danceLeft'); + /* + if (danceLeft) + gfDance.animation.play('danceRight'); + else + gfDance.animation.play('danceLeft'); */ } + var targetShit:Float = 0; + override function update(elapsed:Float) { super.update(elapsed); + + if (callbacks != null) + { + targetShit = FlxMath.remapToRange(callbacks.numRemaining / callbacks.length, 1, 0, 0, 1); + + loadBar.scale.x = FlxMath.lerp(loadBar.scale.x, targetShit, 0.50); + FlxG.watch.addQuick('percentage?', callbacks.numRemaining / callbacks.length); + } + #if debug if (FlxG.keys.justPressed.SPACE) trace('fired: ' + callbacks.getFired() + " unfired:" + callbacks.getUnfired()); diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index 5baa01eb8..88174cacc 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -96,7 +96,8 @@ class MainMenuState extends MusicBeatState // addMenuItem('options', function () startExitState(new OptionMenu())); #if CAN_OPEN_LINKS var hasPopupBlocker = #if web true #else false #end; - menuItems.createItem('donate', selectDonate, hasPopupBlocker); + menuItems.createItem('kickstarter', selectDonate, hasPopupBlocker); + // menuItems.createItem('donate', selectDonate, hasPopupBlocker); #end menuItems.createItem('options', function() startExitState(new OptionsState())); // #if newgrounds @@ -150,9 +151,12 @@ class MainMenuState extends MusicBeatState function selectDonate() { #if linux - Sys.command('/usr/bin/xdg-open', ["https://ninja-muffin24.itch.io/funkin", "&"]); + // Sys.command('/usr/bin/xdg-open', ["https://ninja-muffin24.itch.io/funkin", "&"]); + Sys.command('/usr/bin/xdg-open', ["https://www.kickstarter.com/projects/funkin/", "&"]); #else - FlxG.openURL('https://ninja-muffin24.itch.io/funkin'); + // FlxG.openURL('https://ninja-muffin24.itch.io/funkin'); + + FlxG.openURL('https://www.kickstarter.com/projects/funkin/'); #end } #end diff --git a/source/MenuCharacter.hx b/source/MenuCharacter.hx index ca5f9b499..5403478e1 100644 --- a/source/MenuCharacter.hx +++ b/source/MenuCharacter.hx @@ -25,6 +25,7 @@ class MenuCharacter extends FlxSprite animation.addByPrefix('mom', "Mom Idle BLACK LINES", 24); animation.addByPrefix('parents-christmas', "Parent Christmas Idle", 24); animation.addByPrefix('senpai', "SENPAI idle Black Lines", 24); + animation.addByPrefix('tankman', "Tankman Menu BLACK", 24); // Parent Christmas Idle animation.play(character); diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx index 5dedf9097..1bb3750cf 100644 --- a/source/PauseSubState.hx +++ b/source/PauseSubState.hx @@ -168,6 +168,7 @@ class PauseSubState extends MusicBeatSubstate case "Restart Song": FlxG.resetState(); case "Exit to menu": + PlayState.seenCutscene = false; PlayState.deathCounter = 0; if (PlayState.isStoryMode) FlxG.switchState(new StoryMenuState()); diff --git a/source/PlayState.hx b/source/PlayState.hx index 75197e6d4..5b1d6fb6d 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -102,6 +102,8 @@ class PlayState extends MusicBeatState var dialogue:Array = ['blah blah blah', 'coolswag']; + public static var seenCutscene:Bool = false; + var halloweenBG:FlxSprite; var isHalloween:Bool = false; @@ -149,6 +151,8 @@ class PlayState extends MusicBeatState var detailsPausedText:String = ""; #end + var camPos:FlxPoint; + override public function create() { if (FlxG.sound.music != null) @@ -632,7 +636,7 @@ class PlayState extends MusicBeatState dad = new Character(100, 100, SONG.player2); - var camPos:FlxPoint = new FlxPoint(dad.getGraphicMidpoint().x, dad.getGraphicMidpoint().y); + camPos = new FlxPoint(dad.getGraphicMidpoint().x, dad.getGraphicMidpoint().y); switch (SONG.player2) { @@ -841,8 +845,10 @@ class PlayState extends MusicBeatState // cameras = [FlxG.cameras.list[1]]; startingSong = true; - if (isStoryMode) + if (isStoryMode && !seenCutscene) { + seenCutscene = true; + switch (curSong.toLowerCase()) { case "winter-horrorland": @@ -881,6 +887,13 @@ class PlayState extends MusicBeatState case 'thorns': schoolIntro(doof); + case 'ugh': + ughIntro(); + case 'stress': + stressIntro(); + case 'guns': + gunsIntro(); + default: startCountdown(); } @@ -889,12 +902,9 @@ class PlayState extends MusicBeatState { switch (curSong.toLowerCase()) { - case 'ugh': - ughIntro(); + // REMOVE THIS LATER case 'stress': stressIntro(); - case 'guns': - gunsIntro(); default: startCountdown(); @@ -968,6 +978,8 @@ class PlayState extends MusicBeatState function gunsIntro() { + camFollow.setPosition(camPos.x, camPos.y); + camHUD.visible = false; FlxG.sound.playMusic(Paths.music('DISTORTO'), 0); @@ -1013,6 +1025,9 @@ class PlayState extends MusicBeatState function stressIntro() { + // for story mode shit + camFollow.setPosition(camPos.x, camPos.y); + for (i in 0...7) { var dummyLoader:FlxSprite = new FlxSprite(); @@ -1487,7 +1502,8 @@ class PlayState extends MusicBeatState else vocals = new FlxSound(); - vocals.onComplete = function(){ + vocals.onComplete = function() + { vocalsFinished = true; }; FlxG.sound.list.add(vocals); @@ -1775,14 +1791,14 @@ class PlayState extends MusicBeatState function resyncVocals():Void { if (_exiting) - return ; + return; vocals.pause(); FlxG.sound.music.play(); Conductor.songPosition = FlxG.sound.music.time; if (vocalsFinished) - return ; + return; vocals.time = Conductor.songPosition; vocals.play(); @@ -2152,6 +2168,7 @@ class PlayState extends MusicBeatState function endSong():Void { + seenCutscene = false; deathCounter = 0; canPause = false; FlxG.sound.music.volume = 0; diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index 4e9444075..55ea89e3f 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -29,11 +29,12 @@ class StoryMenuState extends MusicBeatState ['Pico', 'Philly', "Blammed"], ['Satin-Panties', "High", "Milf"], ['Cocoa', 'Eggnog', 'Winter-Horrorland'], - ['Senpai', 'Roses', 'Thorns'] + ['Senpai', 'Roses', 'Thorns'], + ['Ugh', 'Guns', 'Stress'] ]; var curDifficulty:Int = 1; - public static var weekUnlocked:Array = [true, true, true, true, true, true, true]; + public static var weekUnlocked:Array = [true, true, true, true, true, true, true, true]; var weekCharacters:Array = [ ['dad', 'bf', 'gf'], @@ -42,7 +43,8 @@ class StoryMenuState extends MusicBeatState ['pico', 'bf', 'gf'], ['mom', 'bf', 'gf'], ['parents-christmas', 'bf', 'gf'], - ['senpai', 'bf', 'gf'] + ['senpai', 'bf', 'gf'], + ['tankman', 'bf', 'gf'] ]; var weekNames:Array = [ @@ -52,7 +54,8 @@ class StoryMenuState extends MusicBeatState "PICO", "MOMMY MUST MURDER", "RED SNOW", - "hating simulator ft. moawling" + "hating simulator ft. moawling", + "TANKMAN" ]; var txtWeekTitle:FlxText; @@ -112,7 +115,7 @@ class StoryMenuState extends MusicBeatState add(grpLocks); trace("Line 70"); - + #if discord_rpc // Updating Discord Rich Presence DiscordClient.changePresence("In the Menus", null); @@ -419,6 +422,9 @@ class StoryMenuState extends MusicBeatState case 'dad': grpWeekCharacters.members[0].offset.set(120, 200); grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1)); + case 'tankman': + grpWeekCharacters.members[0].offset.set(60, -20); + grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1)); default: grpWeekCharacters.members[0].offset.set(100, 100); diff --git a/source/TankmenBG.hx b/source/TankmenBG.hx index 0109b8ca5..de5bb66c7 100644 --- a/source/TankmenBG.hx +++ b/source/TankmenBG.hx @@ -23,7 +23,7 @@ class TankmenBG extends FlxSprite frames = Paths.getSparrowAtlas('tankmanKilled1'); antialiasing = true; animation.addByPrefix('run', 'tankman running', 24, true); - animation.addByPrefix('shot', 'John', 24, false); + animation.addByPrefix('shot', 'John Shot ' + FlxG.random.int(1, 2), 24, false); animation.play('run'); animation.curAnim.curFrame = FlxG.random.int(0, animation.curAnim.numFrames - 1); diff --git a/source/TitleState.hx b/source/TitleState.hx index 6e4e1222b..9f5bfd3bb 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -20,6 +20,15 @@ import flixel.util.FlxTimer; import lime.app.Application; import lime.ui.Window; import openfl.Assets; +import openfl.display.Sprite; +import openfl.events.AsyncErrorEvent; +import openfl.events.AsyncErrorEvent; +import openfl.events.Event; +import openfl.events.MouseEvent; +import openfl.events.NetStatusEvent; +import openfl.media.Video; +import openfl.net.NetConnection; +import openfl.net.NetStream; import shaderslmfao.ColorSwap; import ui.PreferencesMenu; @@ -50,6 +59,10 @@ class TitleState extends MusicBeatState var swagShader:ColorSwap; var thingie:FlxSprite; + var video:Video; + var netStream:NetStream; + private var overlay:Sprite; + override public function create():Void { #if polymod @@ -96,6 +109,31 @@ class TitleState extends MusicBeatState FlxG.switchState(new FreeplayState()); #elseif CHARTING FlxG.switchState(new ChartingState()); + #elseif web + if (!initialized) + { + video = new Video(); + FlxG.stage.addChild(video); + + var netConnection = new NetConnection(); + netConnection.connect(null); + + netStream = new NetStream(netConnection); + netStream.client = {onMetaData: client_onMetaData}; + netStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, netStream_onAsyncError); + netConnection.addEventListener(NetStatusEvent.NET_STATUS, netConnection_onNetStatus); + // netStream.addEventListener(NetStatusEvent.NET_STATUS) // netStream.play(Paths.file('music/kickstarterTrailer.mp4')); + + overlay = new Sprite(); + overlay.graphics.beginFill(0, 0.5); + overlay.graphics.drawRect(0, 0, 1280, 720); + overlay.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown); + + overlay.buttonMode = true; + FlxG.stage.addChild(overlay); + } + + // netConnection.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown); #else new FlxTimer().start(1, function(tmr:FlxTimer) { @@ -105,14 +143,48 @@ class TitleState extends MusicBeatState #if discord_rpc DiscordClient.initialize(); - - Application.current.onExit.add (function (exitCode) { + + Application.current.onExit.add(function(exitCode) + { DiscordClient.shutdown(); - }); + }); #end } + private function client_onMetaData(metaData:Dynamic) + { + video.attachNetStream(netStream); + + video.width = video.videoWidth; + video.height = video.videoHeight; + } + + private function netStream_onAsyncError(event:AsyncErrorEvent):Void + { + trace("Error loading video"); + } + + private function netConnection_onNetStatus(event:NetStatusEvent):Void + { + if (event.info.code == 'NetStream.Play.Complete') + { + netStream.dispose(); + FlxG.stage.removeChild(video); + + startIntro(); + } + + trace(event.toString()); + } + + private function overlay_onMouseDown(event:MouseEvent):Void + { + netStream.play(Paths.file('music/kickstarterTrailer.mp4')); + FlxG.stage.removeChild(overlay); + } + var logoBl:FlxSprite; + var gfDance:FlxSprite; var danceLeft:Bool = false; var titleText:FlxSprite; @@ -352,8 +424,18 @@ class TitleState extends MusicBeatState skipIntro(); } - if (FlxG.keys.justPressed.SPACE) - swagShader.hasOutline = !swagShader.hasOutline; + #if web + if (!initialized && FlxG.keys.justPressed.ENTER) + { + netStream.dispose(); + FlxG.stage.removeChild(video); + + startIntro(); + } + #end + + // if (FlxG.keys.justPressed.SPACE) + // swagShader.hasOutline = !swagShader.hasOutline; if (controls.UI_LEFT) {