From 84b64efa399701a5f0ace539b01bffd5a4b7c9e8 Mon Sep 17 00:00:00 2001 From: George FunBook Date: Mon, 8 Feb 2021 15:34:48 -0600 Subject: [PATCH] add Paths asset name helper --- source/Alphabet.hx | 4 +- source/BackgroundDancer.hx | 2 +- source/BackgroundGirls.hx | 2 +- source/Character.hx | 41 +++++++------ source/ChartingState.hx | 2 +- source/DialogueBox.hx | 43 +++++++------- source/FreeplayState.hx | 8 +-- source/GameOverSubstate.hx | 6 +- source/HealthIcon.hx | 2 +- source/LatencyState.hx | 2 +- source/MainMenuState.hx | 14 ++--- source/MenuCharacter.hx | 2 +- source/MenuItem.hx | 2 +- source/Note.hx | 10 ++-- source/OptionsMenu.hx | 4 +- source/Paths.hx | 52 +++++++++++++++++ source/PauseSubState.hx | 2 +- source/PlayState.hx | 114 ++++++++++++++++++------------------- source/StoryMenuState.hx | 10 ++-- source/TitleState.hx | 18 +++--- source/import.hx | 1 + 21 files changed, 199 insertions(+), 142 deletions(-) create mode 100644 source/Paths.hx create mode 100644 source/import.hx diff --git a/source/Alphabet.hx b/source/Alphabet.hx index f9bfe23d7..77ac5dc8e 100644 --- a/source/Alphabet.hx +++ b/source/Alphabet.hx @@ -204,7 +204,7 @@ class Alphabet extends FlxSpriteGroup if (FlxG.random.bool(40)) { var daSound:String = "GF_"; - FlxG.sound.play('assets/sounds/' + daSound + FlxG.random.int(1, 4) + TitleState.soundExt, 0.4); + FlxG.sound.play(Paths.soundRandom(daSound, 1, 4)); } add(letter); @@ -245,7 +245,7 @@ class AlphaCharacter extends FlxSprite public function new(x:Float, y:Float) { super(x, y); - var tex = FlxAtlasFrames.fromSparrow('assets/images/alphabet.png', 'assets/images/alphabet.xml'); + var tex = Paths.getSparrowAtlas('alphabet'); frames = tex; antialiasing = true; diff --git a/source/BackgroundDancer.hx b/source/BackgroundDancer.hx index e88c01905..a619dacc2 100644 --- a/source/BackgroundDancer.hx +++ b/source/BackgroundDancer.hx @@ -9,7 +9,7 @@ class BackgroundDancer extends FlxSprite { super(x, y); - frames = FlxAtlasFrames.fromSparrow("assets/images/limo/limoDancer.png", "assets/images/limo/limoDancer.xml"); + frames = Paths.getSparrowAtlas("limo/limoDancer"); animation.addByIndices('danceLeft', 'bg dancer sketch PINK', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); animation.addByIndices('danceRight', 'bg dancer sketch PINK', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); animation.play('danceLeft'); diff --git a/source/BackgroundGirls.hx b/source/BackgroundGirls.hx index 57739fbea..c37b16f91 100644 --- a/source/BackgroundGirls.hx +++ b/source/BackgroundGirls.hx @@ -10,7 +10,7 @@ class BackgroundGirls extends FlxSprite super(x, y); // BG fangirls dissuaded - frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/bgFreaks.png', 'assets/images/weeb/bgFreaks.xml'); + frames = Paths.getSparrowAtlas('weeb/bgFreaks'); animation.addByIndices('danceLeft', 'BG girls group', CoolUtil.numberArray(14), "", 24, false); animation.addByIndices('danceRight', 'BG girls group', CoolUtil.numberArray(30, 15), "", 24, false); diff --git a/source/Character.hx b/source/Character.hx index 821c92898..4177e2b52 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -31,7 +31,7 @@ class Character extends FlxSprite { case 'gf': // GIRLFRIEND CODE - tex = FlxAtlasFrames.fromSparrow('assets/images/GF_assets.png', 'assets/images/GF_assets.xml'); + tex = Paths.getSparrowAtlas('GF_assets'); frames = tex; animation.addByPrefix('cheer', 'GF Cheer', 24, false); animation.addByPrefix('singLEFT', 'GF left note', 24, false); @@ -62,7 +62,7 @@ class Character extends FlxSprite playAnim('danceRight'); case 'gf-christmas': - tex = FlxAtlasFrames.fromSparrow('assets/images/christmas/gfChristmas.png', 'assets/images/christmas/gfChristmas.xml'); + tex = Paths.getSparrowAtlas('christmas/gfChristmas'); frames = tex; animation.addByPrefix('cheer', 'GF Cheer', 24, false); animation.addByPrefix('singLEFT', 'GF left note', 24, false); @@ -93,7 +93,7 @@ class Character extends FlxSprite playAnim('danceRight'); case 'gf-car': - tex = FlxAtlasFrames.fromSparrow('assets/images/gfCar.png', 'assets/images/gfCar.xml'); + tex = Paths.getSparrowAtlas('gfCar'); frames = tex; animation.addByIndices('singUP', 'GF Dancing Beat Hair blowing CAR', [0], "", 24, false); animation.addByIndices('danceLeft', 'GF Dancing Beat Hair blowing CAR', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); @@ -106,7 +106,7 @@ class Character extends FlxSprite playAnim('danceRight'); case 'gf-pixel': - tex = FlxAtlasFrames.fromSparrow('assets/images/weeb/gfPixel.png', 'assets/images/weeb/gfPixel.xml'); + tex = Paths.getSparrowAtlas('weeb/gfPixel'); frames = tex; animation.addByIndices('singUP', 'GF IDLE', [2], "", 24, false); animation.addByIndices('danceLeft', 'GF IDLE', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); @@ -123,7 +123,7 @@ class Character extends FlxSprite case 'dad': // DAD ANIMATION LOADING CODE - tex = FlxAtlasFrames.fromSparrow('assets/images/DADDY_DEAREST.png', 'assets/images/DADDY_DEAREST.xml'); + tex = Paths.getSparrowAtlas('DADDY_DEAREST'); frames = tex; animation.addByPrefix('idle', 'Dad idle dance', 24); animation.addByPrefix('singUP', 'Dad Sing Note UP', 24); @@ -139,7 +139,7 @@ class Character extends FlxSprite playAnim('idle'); case 'spooky': - tex = FlxAtlasFrames.fromSparrow('assets/images/spooky_kids_assets.png', 'assets/images/spooky_kids_assets.xml'); + tex = Paths.getSparrowAtlas('spooky_kids_assets'); frames = tex; animation.addByPrefix('singUP', 'spooky UP NOTE', 24, false); animation.addByPrefix('singDOWN', 'spooky DOWN note', 24, false); @@ -158,7 +158,7 @@ class Character extends FlxSprite playAnim('danceRight'); case 'mom': - tex = FlxAtlasFrames.fromSparrow('assets/images/Mom_Assets.png', 'assets/images/Mom_Assets.xml'); + tex = Paths.getSparrowAtlas('Mom_Assets'); frames = tex; animation.addByPrefix('idle', "Mom Idle", 24, false); @@ -178,7 +178,7 @@ class Character extends FlxSprite playAnim('idle'); case 'mom-car': - tex = FlxAtlasFrames.fromSparrow('assets/images/momCar.png', 'assets/images/momCar.xml'); + tex = Paths.getSparrowAtlas('momCar'); frames = tex; animation.addByPrefix('idle', "Mom Idle", 24, false); @@ -197,7 +197,7 @@ class Character extends FlxSprite playAnim('idle'); case 'monster': - tex = FlxAtlasFrames.fromSparrow('assets/images/Monster_Assets.png', 'assets/images/Monster_Assets.xml'); + tex = Paths.getSparrowAtlas('Monster_Assets'); frames = tex; animation.addByPrefix('idle', 'monster idle', 24, false); animation.addByPrefix('singUP', 'monster up note', 24, false); @@ -212,7 +212,7 @@ class Character extends FlxSprite addOffset("singDOWN", -30, -40); playAnim('idle'); case 'monster-christmas': - tex = FlxAtlasFrames.fromSparrow('assets/images/christmas/monsterChristmas.png', 'assets/images/christmas/monsterChristmas.xml'); + tex = Paths.getSparrowAtlas('christmas/monsterChristmas'); frames = tex; animation.addByPrefix('idle', 'monster idle', 24, false); animation.addByPrefix('singUP', 'monster up note', 24, false); @@ -227,7 +227,7 @@ class Character extends FlxSprite addOffset("singDOWN", -40, -94); playAnim('idle'); case 'pico': - tex = FlxAtlasFrames.fromSparrow('assets/images/Pico_FNF_assetss.png', 'assets/images/Pico_FNF_assetss.xml'); + tex = Paths.getSparrowAtlas('Pico_FNF_assetss'); frames = tex; animation.addByPrefix('idle', "Pico Idle Dance", 24); animation.addByPrefix('singUP', 'pico Up note0', 24, false); @@ -266,7 +266,7 @@ class Character extends FlxSprite flipX = true; case 'bf': - var tex = FlxAtlasFrames.fromSparrow('assets/images/BOYFRIEND.png', 'assets/images/BOYFRIEND.xml'); + var tex = Paths.getSparrowAtlas('BOYFRIEND'); frames = tex; animation.addByPrefix('idle', 'BF idle dance', 24, false); animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false); @@ -305,7 +305,7 @@ class Character extends FlxSprite flipX = true; case 'bf-christmas': - var tex = FlxAtlasFrames.fromSparrow('assets/images/christmas/bfChristmas.png', 'assets/images/christmas/bfChristmas.xml'); + var tex = Paths.getSparrowAtlas('christmas/bfChristmas'); frames = tex; animation.addByPrefix('idle', 'BF idle dance', 24, false); animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false); @@ -333,7 +333,7 @@ class Character extends FlxSprite flipX = true; case 'bf-car': - var tex = FlxAtlasFrames.fromSparrow('assets/images/bfCar.png', 'assets/images/bfCar.xml'); + var tex = Paths.getSparrowAtlas('bfCar'); frames = tex; animation.addByPrefix('idle', 'BF idle dance', 24, false); animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false); @@ -358,7 +358,7 @@ class Character extends FlxSprite flipX = true; case 'bf-pixel': - frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/bfPixel.png', 'assets/images/weeb/bfPixel.xml'); + frames = Paths.getSparrowAtlas('weeb/bfPixel'); animation.addByPrefix('idle', 'BF IDLE', 24, false); animation.addByPrefix('singUP', 'BF UP NOTE', 24, false); animation.addByPrefix('singLEFT', 'BF LEFT NOTE', 24, false); @@ -391,7 +391,7 @@ class Character extends FlxSprite flipX = true; case 'bf-pixel-dead': - frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/bfPixelsDEAD.png', 'assets/images/weeb/bfPixelsDEAD.xml'); + frames = Paths.getSparrowAtlas('weeb/bfPixelsDEAD'); animation.addByPrefix('singUP', "BF Dies pixel", 24, false); animation.addByPrefix('firstDeath', "BF Dies pixel", 24, false); animation.addByPrefix('deathLoop', "Retry Loop", 24, true); @@ -409,7 +409,7 @@ class Character extends FlxSprite flipX = true; case 'senpai': - frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/senpai.png', 'assets/images/weeb/senpai.xml'); + frames = Paths.getSparrowAtlas('weeb/senpai'); animation.addByPrefix('idle', 'Senpai Idle', 24, false); animation.addByPrefix('singUP', 'SENPAI UP NOTE', 24, false); animation.addByPrefix('singLEFT', 'SENPAI LEFT NOTE', 24, false); @@ -429,7 +429,7 @@ class Character extends FlxSprite antialiasing = false; case 'senpai-angry': - frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/senpai.png', 'assets/images/weeb/senpai.xml'); + frames = Paths.getSparrowAtlas('weeb/senpai'); animation.addByPrefix('idle', 'Angry Senpai Idle', 24, false); animation.addByPrefix('singUP', 'Angry Senpai UP NOTE', 24, false); animation.addByPrefix('singLEFT', 'Angry Senpai LEFT NOTE', 24, false); @@ -449,7 +449,7 @@ class Character extends FlxSprite antialiasing = false; case 'spirit': - frames = FlxAtlasFrames.fromSpriteSheetPacker('assets/images/weeb/spirit.png', 'assets/images/weeb/spirit.txt'); + frames = Paths.getPackerAtlas('weeb/spirit'); animation.addByPrefix('idle', "idle spirit_", 24, false); animation.addByPrefix('singUP', "up_", 24, false); animation.addByPrefix('singRIGHT', "right_", 24, false); @@ -470,8 +470,7 @@ class Character extends FlxSprite antialiasing = false; case 'parents-christmas': - frames = FlxAtlasFrames.fromSparrow('assets/images/christmas/mom_dad_christmas_assets.png', - 'assets/images/christmas/mom_dad_christmas_assets.xml'); + frames = Paths.getSparrowAtlas('christmas/mom_dad_christmas_assets'); animation.addByPrefix('idle', 'Parent Christmas Idle', 24, false); animation.addByPrefix('singUP', 'Parent Up Note Dad', 24, false); animation.addByPrefix('singDOWN', 'Parent Down Note Dad', 24, false); diff --git a/source/ChartingState.hx b/source/ChartingState.hx index 4ed3dd909..0e7afa2a2 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -354,7 +354,7 @@ class ChartingState extends MusicBeatState FlxG.sound.playMusic('assets/music/' + daSong + "_Inst" + TitleState.soundExt, 0.6); // WONT WORK FOR TUTORIAL OR TEST SONG!!! REDO LATER - vocals = new FlxSound().loadEmbedded("assets/music/" + daSong + "_Voices" + TitleState.soundExt); + vocals = new FlxSound().loadEmbedded(Paths.music(daSong + "_Voices")); FlxG.sound.list.add(vocals); FlxG.sound.music.pause(); diff --git a/source/DialogueBox.hx b/source/DialogueBox.hx index f9c443952..868c780f2 100644 --- a/source/DialogueBox.hx +++ b/source/DialogueBox.hx @@ -41,10 +41,10 @@ class DialogueBox extends FlxSpriteGroup switch (PlayState.SONG.song.toLowerCase()) { case 'senpai': - FlxG.sound.playMusic('assets/music/Lunchbox' + TitleState.soundExt, 0); + FlxG.sound.playMusic(Paths.music('Lunchbox'), 0); FlxG.sound.music.fadeIn(1, 0, 0.8); case 'thorns': - FlxG.sound.playMusic('assets/music/LunchboxScary' + TitleState.soundExt, 0); + FlxG.sound.playMusic(Paths.music('LunchboxScary'), 0); FlxG.sound.music.fadeIn(1, 0, 0.8); } @@ -61,7 +61,7 @@ class DialogueBox extends FlxSpriteGroup }, 5); portraitLeft = new FlxSprite(-20, 40); - portraitLeft.frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/senpaiPortrait.png', 'assets/images/weeb/senpaiPortrait.xml'); + portraitLeft.frames = Paths.getSparrowAtlas('weeb/senpaiPortrait'); portraitLeft.animation.addByPrefix('enter', 'Senpai Portrait Enter', 24, false); portraitLeft.setGraphicSize(Std.int(portraitLeft.width * PlayState.daPixelZoom * 0.9)); portraitLeft.updateHitbox(); @@ -70,7 +70,7 @@ class DialogueBox extends FlxSpriteGroup portraitLeft.visible = false; portraitRight = new FlxSprite(0, 40); - portraitRight.frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/bfPortrait.png', 'assets/images/weeb/bfPortrait.xml'); + portraitRight.frames = Paths.getSparrowAtlas('weeb/bfPortrait'); portraitRight.animation.addByPrefix('enter', 'Boyfriend portrait enter', 24, false); portraitRight.setGraphicSize(Std.int(portraitRight.width * PlayState.daPixelZoom * 0.9)); portraitRight.updateHitbox(); @@ -79,38 +79,43 @@ class DialogueBox extends FlxSpriteGroup portraitRight.visible = false; box = new FlxSprite(-20, 45); - + + var hasDialog = false; switch (PlayState.SONG.song.toLowerCase()) { case 'senpai': - box.frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/pixelUI/dialogueBox-pixel.png', - 'assets/images/weeb/pixelUI/dialogueBox-pixel.xml'); + hasDialog = true; + box.frames = Paths.getSparrowAtlas('weeb/pixelUI/dialogueBox-pixel'); box.animation.addByPrefix('normalOpen', 'Text Box Appear', 24, false); box.animation.addByIndices('normal', 'Text Box Appear', [4], "", 24); case 'roses': - FlxG.sound.play('assets/sounds/ANGRY_TEXT_BOX' + TitleState.soundExt); + hasDialog = true; + FlxG.sound.play(Paths.sound('ANGRY_TEXT_BOX')); - box.frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/pixelUI/dialogueBox-senpaiMad.png', - 'assets/images/weeb/pixelUI/dialogueBox-senpaiMad.xml'); + box.frames = Paths.getSparrowAtlas('weeb/pixelUI/dialogueBox-senpaiMad'); box.animation.addByPrefix('normalOpen', 'SENPAI ANGRY IMPACT SPEECH', 24, false); box.animation.addByIndices('normal', 'SENPAI ANGRY IMPACT SPEECH', [4], "", 24); case 'thorns': - box.frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/pixelUI/dialogueBox-evil.png', 'assets/images/weeb/pixelUI/dialogueBox-evil.xml'); + hasDialog = true; + box.frames = Paths.getSparrowAtlas('weeb/pixelUI/dialogueBox-evil'); box.animation.addByPrefix('normalOpen', 'Spirit Textbox spawn', 24, false); box.animation.addByIndices('normal', 'Spirit Textbox spawn', [11], "", 24); - var face:FlxSprite = new FlxSprite(320, 170).loadGraphic('assets/images/weeb/spiritFaceForward.png'); + var face:FlxSprite = new FlxSprite(320, 170).loadGraphic(Paths.image('weeb/spiritFaceForward')); face.setGraphicSize(Std.int(face.width * 6)); add(face); } - box.animation.play('normalOpen'); - box.setGraphicSize(Std.int(box.width * PlayState.daPixelZoom * 0.9)); - box.updateHitbox(); - add(box); + if (hasDialog) + { + box.animation.play('normalOpen'); + box.setGraphicSize(Std.int(box.width * PlayState.daPixelZoom * 0.9)); + box.updateHitbox(); + add(box); + } - handSelect = new FlxSprite(FlxG.width * 0.9, FlxG.height * 0.9).loadGraphic('assets/images/weeb/pixelUI/hand_textbox.png'); + handSelect = new FlxSprite(FlxG.width * 0.9, FlxG.height * 0.9).loadGraphic(Paths.image('weeb/pixelUI/hand_textbox')); add(handSelect); box.screenCenter(X); @@ -129,7 +134,7 @@ class DialogueBox extends FlxSpriteGroup swagDialogue = new FlxTypeText(240, 500, Std.int(FlxG.width * 0.6), "", 32); swagDialogue.font = 'Pixel Arial 11 Bold'; swagDialogue.color = 0xFF3F2021; - swagDialogue.sounds = [FlxG.sound.load('assets/sounds/pixelText' + TitleState.soundExt, 0.6)]; + swagDialogue.sounds = [FlxG.sound.load(Paths.sound('pixelText'), 0.6)]; add(swagDialogue); dialogue = new Alphabet(0, 80, "", false, true); @@ -175,7 +180,7 @@ class DialogueBox extends FlxSpriteGroup { remove(dialogue); - FlxG.sound.play('assets/sounds/clickText' + TitleState.soundExt, 0.8); + FlxG.sound.play(Paths.sound('clickText'), 0.8); if (dialogueList[1] == null) { diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 32373c354..a51c0c65a 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -36,7 +36,7 @@ class FreeplayState extends MusicBeatState if (FlxG.sound.music != null) { if (!FlxG.sound.music.playing) - FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt); + FlxG.sound.playMusic(Paths.music('freakyMenu')); } */ @@ -85,7 +85,7 @@ class FreeplayState extends MusicBeatState // LOAD CHARACTERS - var bg:FlxSprite = new FlxSprite().loadGraphic('assets/images/menuBGBlue.png'); + var bg:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuBGBlue')); add(bg); grpSongs = new FlxTypedGroup(); @@ -120,7 +120,7 @@ class FreeplayState extends MusicBeatState changeSelection(); changeDiff(); - // FlxG.sound.playMusic('assets/music/title' + TitleState.soundExt, 0); + // FlxG.sound.playMusic(Paths.music('title'), 0); // FlxG.sound.music.fadeIn(2, 0, 0.8); selector = new FlxText(); @@ -235,7 +235,7 @@ class FreeplayState extends MusicBeatState #end // NGio.logEvent('Fresh'); - FlxG.sound.play('assets/sounds/scrollMenu' + TitleState.soundExt, 0.4); + FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); curSelected += change; diff --git a/source/GameOverSubstate.hx b/source/GameOverSubstate.hx index 58fecb58f..b403296eb 100644 --- a/source/GameOverSubstate.hx +++ b/source/GameOverSubstate.hx @@ -40,7 +40,7 @@ class GameOverSubstate extends MusicBeatSubstate camFollow = new FlxObject(bf.getGraphicMidpoint().x, bf.getGraphicMidpoint().y, 1, 1); add(camFollow); - FlxG.sound.play('assets/sounds/fnf_loss_sfx' + stageSuffix + TitleState.soundExt); + FlxG.sound.play(Paths.sound('fnf_loss_sfx' + stageSuffix)); Conductor.changeBPM(100); // FlxG.camera.followLerp = 1; @@ -77,7 +77,7 @@ class GameOverSubstate extends MusicBeatSubstate if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.finished) { - FlxG.sound.playMusic('assets/music/gameOver' + stageSuffix + TitleState.soundExt); + FlxG.sound.playMusic(Paths.music('gameOver' + stageSuffix)); } if (FlxG.sound.music.playing) @@ -102,7 +102,7 @@ class GameOverSubstate extends MusicBeatSubstate isEnding = true; bf.playAnim('deathConfirm', true); FlxG.sound.music.stop(); - FlxG.sound.play('assets/music/gameOverEnd' + stageSuffix + TitleState.soundExt); + FlxG.sound.play(Paths.music('gameOverEnd' + stageSuffix)); new FlxTimer().start(0.7, function(tmr:FlxTimer) { FlxG.camera.fade(FlxColor.BLACK, 2, false, function() diff --git a/source/HealthIcon.hx b/source/HealthIcon.hx index b9810e95c..a7c71578a 100644 --- a/source/HealthIcon.hx +++ b/source/HealthIcon.hx @@ -7,7 +7,7 @@ class HealthIcon extends FlxSprite public function new(char:String = 'bf', isPlayer:Bool = false) { super(); - loadGraphic('assets/images/iconGrid.png', true, 150, 150); + loadGraphic(Paths.image('iconGrid'), true, 150, 150); antialiasing = true; animation.add('bf', [0, 1], 0, false, isPlayer); diff --git a/source/LatencyState.hx b/source/LatencyState.hx index 8ff4fab95..1136330e5 100644 --- a/source/LatencyState.hx +++ b/source/LatencyState.hx @@ -14,7 +14,7 @@ class LatencyState extends FlxState override function create() { - FlxG.sound.playMusic('assets/sounds/soundTest' + TitleState.soundExt); + FlxG.sound.playMusic(Paths.sound('soundTest')); noteGrp = new FlxTypedGroup(); add(noteGrp); diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index e1a1db228..dbd4b2a86 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -34,12 +34,12 @@ class MainMenuState extends MusicBeatState { if (!FlxG.sound.music.playing) { - FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt); + FlxG.sound.playMusic(Paths.music('freakyMenu')); } persistentUpdate = persistentDraw = true; - var bg:FlxSprite = new FlxSprite(-80).loadGraphic('assets/images/menuBG.png'); + var bg:FlxSprite = new FlxSprite(-80).loadGraphic(Paths.image('menuBG')); bg.scrollFactor.x = 0; bg.scrollFactor.y = 0.18; bg.setGraphicSize(Std.int(bg.width * 1.1)); @@ -51,7 +51,7 @@ class MainMenuState extends MusicBeatState camFollow = new FlxObject(0, 0, 1, 1); add(camFollow); - magenta = new FlxSprite(-80).loadGraphic('assets/images/menuDesat.png'); + magenta = new FlxSprite(-80).loadGraphic(Paths.image('menuDesat')); magenta.scrollFactor.x = 0; magenta.scrollFactor.y = 0.18; magenta.setGraphicSize(Std.int(magenta.width * 1.1)); @@ -66,7 +66,7 @@ class MainMenuState extends MusicBeatState menuItems = new FlxTypedGroup(); add(menuItems); - var tex = FlxAtlasFrames.fromSparrow('assets/images/FNF_main_menu_assets.png', 'assets/images/FNF_main_menu_assets.xml'); + var tex = Paths.getSparrowAtlas('FNF_main_menu_assets'); for (i in 0...optionShit.length) { @@ -109,13 +109,13 @@ class MainMenuState extends MusicBeatState { if (controls.UP_P) { - FlxG.sound.play('assets/sounds/scrollMenu' + TitleState.soundExt); + FlxG.sound.play(Paths.sound('scrollMenu')); changeItem(-1); } if (controls.DOWN_P) { - FlxG.sound.play('assets/sounds/scrollMenu' + TitleState.soundExt); + FlxG.sound.play(Paths.sound('scrollMenu')); changeItem(1); } @@ -137,7 +137,7 @@ class MainMenuState extends MusicBeatState else { selectedSomethin = true; - FlxG.sound.play('assets/sounds/confirmMenu' + TitleState.soundExt); + FlxG.sound.play(Paths.sound('confirmMenu')); FlxFlicker.flicker(magenta, 1.1, 0.15, false); diff --git a/source/MenuCharacter.hx b/source/MenuCharacter.hx index c8d50134d..ca5f9b499 100644 --- a/source/MenuCharacter.hx +++ b/source/MenuCharacter.hx @@ -13,7 +13,7 @@ class MenuCharacter extends FlxSprite this.character = character; - var tex = FlxAtlasFrames.fromSparrow('assets/images/campaign_menu_UI_characters.png', 'assets/images/campaign_menu_UI_characters.xml'); + var tex = Paths.getSparrowAtlas('campaign_menu_UI_characters'); frames = tex; animation.addByPrefix('bf', "BF idle dance white", 24); diff --git a/source/MenuItem.hx b/source/MenuItem.hx index 431e8ac77..fe3c9f238 100644 --- a/source/MenuItem.hx +++ b/source/MenuItem.hx @@ -14,7 +14,7 @@ class MenuItem extends FlxSpriteGroup { super(x, y); - var tex = FlxAtlasFrames.fromSparrow('assets/images/campaign_menu_UI_assets.png', 'assets/images/campaign_menu_UI_assets.xml'); + var tex = Paths.getSparrowAtlas('campaign_menu_UI_assets'); week = new FlxSprite(); week.frames = tex; diff --git a/source/Note.hx b/source/Note.hx index 32e1b5c18..781206b3f 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -52,7 +52,7 @@ class Note extends FlxSprite switch (daStage) { case 'school': - loadGraphic('assets/images/weeb/pixelUI/arrows-pixels.png', true, 17, 17); + loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels'), true, 17, 17); animation.add('greenScroll', [6]); animation.add('redScroll', [7]); @@ -61,7 +61,7 @@ class Note extends FlxSprite if (isSustainNote) { - loadGraphic('assets/images/weeb/pixelUI/arrowEnds.png', true, 7, 6); + loadGraphic(Paths.image('weeb/pixelUI/arrowEnds'), true, 7, 6); animation.add('purpleholdend', [4]); animation.add('greenholdend', [6]); @@ -78,7 +78,7 @@ class Note extends FlxSprite updateHitbox(); case 'schoolEvil': // COPY PASTED CUZ I AM LAZY - loadGraphic('assets/images/weeb/pixelUI/arrows-pixels.png', true, 17, 17); + loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels'), true, 17, 17); animation.add('greenScroll', [6]); animation.add('redScroll', [7]); @@ -87,7 +87,7 @@ class Note extends FlxSprite if (isSustainNote) { - loadGraphic('assets/images/weeb/pixelUI/arrowEnds.png', true, 7, 6); + loadGraphic(Paths.image('weeb/pixelUI/arrowEnds'), true, 7, 6); animation.add('purpleholdend', [4]); animation.add('greenholdend', [6]); @@ -104,7 +104,7 @@ class Note extends FlxSprite updateHitbox(); default: - frames = FlxAtlasFrames.fromSparrow('assets/images/NOTE_assets.png', 'assets/images/NOTE_assets.xml'); + frames = Paths.getSparrowAtlas('NOTE_assets'); animation.addByPrefix('greenScroll', 'green0'); animation.addByPrefix('redScroll', 'red0'); diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 299944af7..76a175890 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -23,7 +23,7 @@ class OptionsMenu extends MusicBeatState override function create() { - var menuBG:FlxSprite = new FlxSprite().loadGraphic('assets/images/menuDesat.png'); + var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuDesat')); controlsStrings = CoolUtil.coolTextFile('assets/data/controls.txt'); menuBG.color = 0xFFea71fd; menuBG.setGraphicSize(Std.int(menuBG.width * 1.1)); @@ -97,7 +97,7 @@ class OptionsMenu extends MusicBeatState NGio.logEvent('Fresh'); #end - FlxG.sound.play('assets/sounds/scrollMenu' + TitleState.soundExt, 0.4); + FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); curSelected += change; diff --git a/source/Paths.hx b/source/Paths.hx new file mode 100644 index 000000000..90f3f914d --- /dev/null +++ b/source/Paths.hx @@ -0,0 +1,52 @@ +package; + +import openfl.utils.Assets as OpenFlAssets; + +import flixel.FlxG; +import flixel.graphics.frames.FlxAtlasFrames; + +class Paths +{ + inline public static var SOUND_EXT = #if web "mp3" #else "ogg" #end; + + static var currentLevel:String; + + static public function file(file:String) + { + var path = 'assets/$file'; + if (currentLevel != null && OpenFlAssets.exists('$currentLevel:$path')) + return '$currentLevel:$path'; + + return path; + } + + inline static public function sound(key:String) + { + return file('sounds/$key.$SOUND_EXT'); + } + + inline static public function soundRandom(key:String, min:Int, max:Int) + { + return file('sounds/$key${FlxG.random.int(min, max)}.$SOUND_EXT'); + } + + inline static public function music(key:String) + { + return file('music/$key.$SOUND_EXT'); + } + + inline static public function image(key:String) + { + return file('images/$key.png'); + } + + inline static public function getSparrowAtlas(key:String) + { + return FlxAtlasFrames.fromSparrow(image(key), file('images/$key.xml')); + } + + inline static public function getPackerAtlas(key:String) + { + return FlxAtlasFrames.fromSpriteSheetPacker(image(key), file('images/$key.txt')); + } +} \ No newline at end of file diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx index ac747dbca..e7371ed1d 100644 --- a/source/PauseSubState.hx +++ b/source/PauseSubState.hx @@ -22,7 +22,7 @@ class PauseSubState extends MusicBeatSubstate { super(); - pauseMusic = new FlxSound().loadEmbedded('assets/music/breakfast' + TitleState.soundExt, true, true); + pauseMusic = new FlxSound().loadEmbedded(Paths.music('breakfast'), true, true); pauseMusic.volume = 0; pauseMusic.play(false, FlxG.random.int(0, Std.int(pauseMusic.length / 2))); diff --git a/source/PlayState.hx b/source/PlayState.hx index cc869e5de..5536c9225 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -174,7 +174,7 @@ class PlayState extends MusicBeatState curStage = "spooky"; halloweenLevel = true; - var hallowTex = FlxAtlasFrames.fromSparrow('assets/images/halloween_bg.png', 'assets/images/halloween_bg.xml'); + var hallowTex = Paths.getSparrowAtlas('halloween_bg'); halloweenBG = new FlxSprite(-200, -100); halloweenBG.frames = hallowTex; @@ -190,11 +190,11 @@ class PlayState extends MusicBeatState { curStage = 'philly'; - var bg:FlxSprite = new FlxSprite(-100).loadGraphic('assets/images/philly/sky.png'); + var bg:FlxSprite = new FlxSprite(-100).loadGraphic(Paths.image('philly/sky')); bg.scrollFactor.set(0.1, 0.1); add(bg); - var city:FlxSprite = new FlxSprite(-10).loadGraphic('assets/images/philly/city.png'); + var city:FlxSprite = new FlxSprite(-10).loadGraphic(Paths.image('philly/city')); city.scrollFactor.set(0.3, 0.3); city.setGraphicSize(Std.int(city.width * 0.85)); city.updateHitbox(); @@ -205,7 +205,7 @@ class PlayState extends MusicBeatState for (i in 0...5) { - var light:FlxSprite = new FlxSprite(city.x).loadGraphic('assets/images/philly/win' + i + '.png'); + var light:FlxSprite = new FlxSprite(city.x).loadGraphic(Paths.image('philly/win' + i)); light.scrollFactor.set(0.3, 0.3); light.visible = false; light.setGraphicSize(Std.int(light.width * 0.85)); @@ -213,18 +213,18 @@ class PlayState extends MusicBeatState phillyCityLights.add(light); } - var streetBehind:FlxSprite = new FlxSprite(-40, 50).loadGraphic('assets/images/philly/behindTrain.png'); + var streetBehind:FlxSprite = new FlxSprite(-40, 50).loadGraphic(Paths.image('philly/behindTrain')); add(streetBehind); - phillyTrain = new FlxSprite(2000, 360).loadGraphic('assets/images/philly/train.png'); + phillyTrain = new FlxSprite(2000, 360).loadGraphic(Paths.image('philly/train')); add(phillyTrain); - trainSound = new FlxSound().loadEmbedded('assets/sounds/train_passes' + TitleState.soundExt); + trainSound = new FlxSound().loadEmbedded(Paths.sound('train_passes')); FlxG.sound.list.add(trainSound); // var cityLights:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.win0.png); - var street:FlxSprite = new FlxSprite(-40, streetBehind.y).loadGraphic('assets/images/philly/street.png'); + var street:FlxSprite = new FlxSprite(-40, streetBehind.y).loadGraphic(Paths.image('philly/street')); add(street); } else if (SONG.song.toLowerCase() == 'milf' || SONG.song.toLowerCase() == 'satin-panties' || SONG.song.toLowerCase() == 'high') @@ -232,12 +232,12 @@ class PlayState extends MusicBeatState curStage = 'limo'; defaultCamZoom = 0.90; - var skyBG:FlxSprite = new FlxSprite(-120, -50).loadGraphic('assets/images/limo/limoSunset.png'); + var skyBG:FlxSprite = new FlxSprite(-120, -50).loadGraphic(Paths.image('limo/limoSunset')); skyBG.scrollFactor.set(0.1, 0.1); add(skyBG); var bgLimo:FlxSprite = new FlxSprite(-200, 480); - bgLimo.frames = FlxAtlasFrames.fromSparrow('assets/images/limo/bgLimo.png', 'assets/images/limo/bgLimo.xml'); + bgLimo.frames = Paths.getSparrowAtlas('limo/bgLimo'); bgLimo.animation.addByPrefix('drive', "background limo pink", 24); bgLimo.animation.play('drive'); bgLimo.scrollFactor.set(0.4, 0.4); @@ -253,7 +253,7 @@ class PlayState extends MusicBeatState grpLimoDancers.add(dancer); } - var overlayShit:FlxSprite = new FlxSprite(-500, -600).loadGraphic('assets/images/limo/limoOverlay.png'); + var overlayShit:FlxSprite = new FlxSprite(-500, -600).loadGraphic(Paths.image('limo/limoOverlay')); overlayShit.alpha = 0.5; // add(overlayShit); @@ -263,7 +263,7 @@ class PlayState extends MusicBeatState // overlayShit.shader = shaderBullshit; - var limoTex = FlxAtlasFrames.fromSparrow('assets/images/limo/limoDrive.png', 'assets/images/limo/limoDrive.xml'); + var limoTex = Paths.getSparrowAtlas('limo/limoDrive'); limo = new FlxSprite(-120, 550); limo.frames = limoTex; @@ -271,7 +271,7 @@ class PlayState extends MusicBeatState limo.animation.play('drive'); limo.antialiasing = true; - fastCar = new FlxSprite(-300, 160).loadGraphic('assets/images/limo/fastCarLol.png'); + fastCar = new FlxSprite(-300, 160).loadGraphic(Paths.image('limo/fastCarLol')); // add(limo); } else if (SONG.song.toLowerCase() == 'cocoa' || SONG.song.toLowerCase() == 'eggnog') @@ -280,7 +280,7 @@ class PlayState extends MusicBeatState defaultCamZoom = 0.80; - var bg:FlxSprite = new FlxSprite(-1000, -500).loadGraphic('assets/images/christmas/bgWalls.png'); + var bg:FlxSprite = new FlxSprite(-1000, -500).loadGraphic(Paths.image('christmas/bgWalls')); bg.antialiasing = true; bg.scrollFactor.set(0.2, 0.2); bg.active = false; @@ -289,7 +289,7 @@ class PlayState extends MusicBeatState add(bg); upperBoppers = new FlxSprite(-240, -90); - upperBoppers.frames = FlxAtlasFrames.fromSparrow('assets/images/christmas/upperBop.png', 'assets/images/christmas/upperBop.xml'); + upperBoppers.frames = Paths.getSparrowAtlas('christmas/upperBop'); upperBoppers.animation.addByPrefix('bop', "Upper Crowd Bob", 24, false); upperBoppers.antialiasing = true; upperBoppers.scrollFactor.set(0.33, 0.33); @@ -297,7 +297,7 @@ class PlayState extends MusicBeatState upperBoppers.updateHitbox(); add(upperBoppers); - var bgEscalator:FlxSprite = new FlxSprite(-1100, -600).loadGraphic('assets/images/christmas/bgEscalator.png'); + var bgEscalator:FlxSprite = new FlxSprite(-1100, -600).loadGraphic(Paths.image('christmas/bgEscalator')); bgEscalator.antialiasing = true; bgEscalator.scrollFactor.set(0.3, 0.3); bgEscalator.active = false; @@ -305,13 +305,13 @@ class PlayState extends MusicBeatState bgEscalator.updateHitbox(); add(bgEscalator); - var tree:FlxSprite = new FlxSprite(370, -250).loadGraphic('assets/images/christmas/christmasTree.png'); + var tree:FlxSprite = new FlxSprite(370, -250).loadGraphic(Paths.image('christmas/christmasTree')); tree.antialiasing = true; tree.scrollFactor.set(0.40, 0.40); add(tree); bottomBoppers = new FlxSprite(-300, 140); - bottomBoppers.frames = FlxAtlasFrames.fromSparrow('assets/images/christmas/bottomBop.png', 'assets/images/christmas/bottomBop.xml'); + bottomBoppers.frames = Paths.getSparrowAtlas('christmas/bottomBop'); bottomBoppers.animation.addByPrefix('bop', 'Bottom Level Boppers', 24, false); bottomBoppers.antialiasing = true; bottomBoppers.scrollFactor.set(0.9, 0.9); @@ -319,13 +319,13 @@ class PlayState extends MusicBeatState bottomBoppers.updateHitbox(); add(bottomBoppers); - var fgSnow:FlxSprite = new FlxSprite(-600, 700).loadGraphic('assets/images/christmas/fgSnow.png'); + var fgSnow:FlxSprite = new FlxSprite(-600, 700).loadGraphic(Paths.image('christmas/fgSnow')); fgSnow.active = false; fgSnow.antialiasing = true; add(fgSnow); santa = new FlxSprite(-840, 150); - santa.frames = FlxAtlasFrames.fromSparrow('assets/images/christmas/santa.png', 'assets/images/christmas/santa.xml'); + santa.frames = Paths.getSparrowAtlas('christmas/santa'); santa.animation.addByPrefix('idle', 'santa idle in fear', 24, false); santa.antialiasing = true; add(santa); @@ -333,7 +333,7 @@ class PlayState extends MusicBeatState else if (SONG.song.toLowerCase() == 'winter-horrorland') { curStage = 'mallEvil'; - var bg:FlxSprite = new FlxSprite(-400, -500).loadGraphic('assets/images/christmas/evilBG.png'); + var bg:FlxSprite = new FlxSprite(-400, -500).loadGraphic(Paths.image('christmas/evilBG')); bg.antialiasing = true; bg.scrollFactor.set(0.2, 0.2); bg.active = false; @@ -341,12 +341,12 @@ class PlayState extends MusicBeatState bg.updateHitbox(); add(bg); - var evilTree:FlxSprite = new FlxSprite(300, -300).loadGraphic('assets/images/christmas/evilTree.png'); + var evilTree:FlxSprite = new FlxSprite(300, -300).loadGraphic(Paths.image('christmas/evilTree')); evilTree.antialiasing = true; evilTree.scrollFactor.set(0.2, 0.2); add(evilTree); - var evilSnow:FlxSprite = new FlxSprite(-200, 700).loadGraphic("assets/images/christmas/evilSnow.png"); + var evilSnow:FlxSprite = new FlxSprite(-200, 700).loadGraphic(Paths.image("christmas/evilSnow")); evilSnow.antialiasing = true; add(evilSnow); } @@ -356,26 +356,26 @@ class PlayState extends MusicBeatState // defaultCamZoom = 0.9; - var bgSky = new FlxSprite().loadGraphic('assets/images/weeb/weebSky.png'); + var bgSky = new FlxSprite().loadGraphic(Paths.image('weeb/weebSky')); bgSky.scrollFactor.set(0.1, 0.1); add(bgSky); var repositionShit = -200; - var bgSchool:FlxSprite = new FlxSprite(repositionShit, 0).loadGraphic('assets/images/weeb/weebSchool.png'); + var bgSchool:FlxSprite = new FlxSprite(repositionShit, 0).loadGraphic(Paths.image('weeb/weebSchool')); bgSchool.scrollFactor.set(0.6, 0.90); add(bgSchool); - var bgStreet:FlxSprite = new FlxSprite(repositionShit).loadGraphic('assets/images/weeb/weebStreet.png'); + var bgStreet:FlxSprite = new FlxSprite(repositionShit).loadGraphic(Paths.image('weeb/weebStreet')); bgStreet.scrollFactor.set(0.95, 0.95); add(bgStreet); - var fgTrees:FlxSprite = new FlxSprite(repositionShit + 170, 130).loadGraphic('assets/images/weeb/weebTreesBack.png'); + var fgTrees:FlxSprite = new FlxSprite(repositionShit + 170, 130).loadGraphic(Paths.image('weeb/weebTreesBack')); fgTrees.scrollFactor.set(0.9, 0.9); add(fgTrees); var bgTrees:FlxSprite = new FlxSprite(repositionShit - 380, -800); - var treetex = FlxAtlasFrames.fromSpriteSheetPacker('assets/images/weeb/weebTrees.png', 'assets/images/weeb/weebTrees.txt'); + var treetex = Paths.getPackerAtlas('weeb/weebTrees'); bgTrees.frames = treetex; bgTrees.animation.add('treeLoop', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], 12); bgTrees.animation.play('treeLoop'); @@ -383,7 +383,7 @@ class PlayState extends MusicBeatState add(bgTrees); var treeLeaves:FlxSprite = new FlxSprite(repositionShit, -40); - treeLeaves.frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/petals.png', 'assets/images/weeb/petals.xml'); + treeLeaves.frames = Paths.getSparrowAtlas('weeb/petals'); treeLeaves.animation.addByPrefix('leaves', 'PETALS ALL', 24, true); treeLeaves.animation.play('leaves'); treeLeaves.scrollFactor.set(0.85, 0.85); @@ -428,7 +428,7 @@ class PlayState extends MusicBeatState var posY = 200; var bg:FlxSprite = new FlxSprite(posX, posY); - bg.frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/animatedEvilSchool.png', 'assets/images/weeb/animatedEvilSchool.xml'); + bg.frames = Paths.getSparrowAtlas('weeb/animatedEvilSchool'); bg.animation.addByPrefix('idle', 'background 2', 24); bg.animation.play('idle'); bg.scrollFactor.set(0.8, 0.9); @@ -436,13 +436,13 @@ class PlayState extends MusicBeatState add(bg); /* - var bg:FlxSprite = new FlxSprite(posX, posY).loadGraphic('assets/images/weeb/evilSchoolBG.png'); + var bg:FlxSprite = new FlxSprite(posX, posY).loadGraphic(Paths.image('weeb/evilSchoolBG')); bg.scale.set(6, 6); // bg.setGraphicSize(Std.int(bg.width * 6)); // bg.updateHitbox(); add(bg); - var fg:FlxSprite = new FlxSprite(posX, posY).loadGraphic('assets/images/weeb/evilSchoolFG.png'); + var fg:FlxSprite = new FlxSprite(posX, posY).loadGraphic(Paths.image('weeb/evilSchoolFG')); fg.scale.set(6, 6); // fg.setGraphicSize(Std.int(fg.width * 6)); // fg.updateHitbox(); @@ -483,7 +483,7 @@ class PlayState extends MusicBeatState { defaultCamZoom = 0.9; curStage = 'stage'; - var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic('assets/images/stageback.png'); + var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(Paths.image('stageback')); // bg.setGraphicSize(Std.int(bg.width * 2.5)); // bg.updateHitbox(); bg.antialiasing = true; @@ -491,7 +491,7 @@ class PlayState extends MusicBeatState bg.active = false; add(bg); - var stageFront:FlxSprite = new FlxSprite(-650, 600).loadGraphic('assets/images/stagefront.png'); + var stageFront:FlxSprite = new FlxSprite(-650, 600).loadGraphic(Paths.image('stagefront')); stageFront.setGraphicSize(Std.int(stageFront.width * 1.1)); stageFront.updateHitbox(); stageFront.antialiasing = true; @@ -499,7 +499,7 @@ class PlayState extends MusicBeatState stageFront.active = false; add(stageFront); - var stageCurtains:FlxSprite = new FlxSprite(-500, -300).loadGraphic('assets/images/stagecurtains.png'); + var stageCurtains:FlxSprite = new FlxSprite(-500, -300).loadGraphic(Paths.image('stagecurtains')); stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9)); stageCurtains.updateHitbox(); stageCurtains.antialiasing = true; @@ -662,7 +662,7 @@ class PlayState extends MusicBeatState FlxG.fixedTimestep = false; - healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic('assets/images/healthBar.png'); + healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(Paths.image('healthBar')); healthBarBG.screenCenter(X); healthBarBG.scrollFactor.set(); add(healthBarBG); @@ -716,7 +716,7 @@ class PlayState extends MusicBeatState new FlxTimer().start(0.1, function(tmr:FlxTimer) { remove(blackScreen); - FlxG.sound.play('assets/sounds/Lights_Turn_On' + TitleState.soundExt); + FlxG.sound.play(Paths.sound('Lights_Turn_On')); camFollow.y = -2050; camFollow.x += 200; FlxG.camera.focusOn(camFollow.getPosition()); @@ -738,7 +738,7 @@ class PlayState extends MusicBeatState case 'senpai': schoolIntro(doof); case 'roses': - FlxG.sound.play('assets/sounds/ANGRY' + TitleState.soundExt); + FlxG.sound.play(Paths.sound('ANGRY')); schoolIntro(doof); case 'thorns': schoolIntro(doof); @@ -768,7 +768,7 @@ class PlayState extends MusicBeatState red.scrollFactor.set(); var senpaiEvil:FlxSprite = new FlxSprite(); - senpaiEvil.frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/senpaiCrazy.png', 'assets/images/weeb/senpaiCrazy.xml'); + senpaiEvil.frames = Paths.getSparrowAtlas('weeb/senpaiCrazy'); senpaiEvil.animation.addByPrefix('idle', 'Senpai Pre Explosion', 24, false); senpaiEvil.setGraphicSize(Std.int(senpaiEvil.width * 6)); senpaiEvil.updateHitbox(); @@ -812,7 +812,7 @@ class PlayState extends MusicBeatState else { senpaiEvil.animation.play('idle'); - FlxG.sound.play('assets/sounds/Senpai_Dies' + TitleState.soundExt, 1, false, null, true, function() + FlxG.sound.play(Paths.sound('Senpai_Dies'), 1, false, null, true, function() { remove(senpaiEvil); remove(red); @@ -893,7 +893,7 @@ class PlayState extends MusicBeatState { case 0: - FlxG.sound.play('assets/sounds/intro3' + altSuffix + TitleState.soundExt, 0.6); + FlxG.sound.play(Paths.sound('intro3'), 0.6); case 1: var ready:FlxSprite = new FlxSprite().loadGraphic('assets/images/' + introAlts[0]); ready.scrollFactor.set(); @@ -911,7 +911,7 @@ class PlayState extends MusicBeatState ready.destroy(); } }); - FlxG.sound.play('assets/sounds/intro2' + altSuffix + TitleState.soundExt, 0.6); + FlxG.sound.play(Paths.sound('intro2'), 0.6); case 2: var set:FlxSprite = new FlxSprite().loadGraphic('assets/images/' + introAlts[1]); set.scrollFactor.set(); @@ -928,7 +928,7 @@ class PlayState extends MusicBeatState set.destroy(); } }); - FlxG.sound.play('assets/sounds/intro1' + altSuffix + TitleState.soundExt, 0.6); + FlxG.sound.play(Paths.sound('intro1'), 0.6); case 3: var go:FlxSprite = new FlxSprite().loadGraphic('assets/images/' + introAlts[2]); go.scrollFactor.set(); @@ -947,7 +947,7 @@ class PlayState extends MusicBeatState go.destroy(); } }); - FlxG.sound.play('assets/sounds/introGo' + altSuffix + TitleState.soundExt, 0.6); + FlxG.sound.play(Paths.sound('introGo'), 0.6); case 4: } @@ -968,7 +968,7 @@ class PlayState extends MusicBeatState lastReportedPlayheadPosition = 0; if (!paused) - FlxG.sound.playMusic("assets/music/" + SONG.song + "_Inst" + TitleState.soundExt, 1, false); + FlxG.sound.playMusic(Paths.music(SONG.song + "_Inst"), 1, false); FlxG.sound.music.onComplete = endSong; vocals.play(); } @@ -985,7 +985,7 @@ class PlayState extends MusicBeatState curSong = songData.song; if (SONG.needsVoices) - vocals = new FlxSound().loadEmbedded("assets/music/" + curSong + "_Voices" + TitleState.soundExt); + vocals = new FlxSound().loadEmbedded(Paths.music(curSong + "_Voices")); else vocals = new FlxSound(); @@ -1085,7 +1085,7 @@ class PlayState extends MusicBeatState switch (curStage) { case 'school': - babyArrow.loadGraphic('assets/images/weeb/pixelUI/arrows-pixels.png', true, 17, 17); + babyArrow.loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels'), true, 17, 17); babyArrow.animation.add('green', [6]); babyArrow.animation.add('red', [7]); babyArrow.animation.add('blue', [5]); @@ -1122,7 +1122,7 @@ class PlayState extends MusicBeatState case 'schoolEvil': // ALL THIS IS COPY PASTED CUZ IM LAZY - babyArrow.loadGraphic('assets/images/weeb/pixelUI/arrows-pixels.png', true, 17, 17); + babyArrow.loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels'), true, 17, 17); babyArrow.animation.add('green', [6]); babyArrow.animation.add('red', [7]); babyArrow.animation.add('blue', [5]); @@ -1157,7 +1157,7 @@ class PlayState extends MusicBeatState } default: - babyArrow.frames = FlxAtlasFrames.fromSparrow('assets/images/NOTE_assets.png', 'assets/images/NOTE_assets.xml'); + babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets'); babyArrow.animation.addByPrefix('green', 'arrowUP'); babyArrow.animation.addByPrefix('blue', 'arrowDOWN'); babyArrow.animation.addByPrefix('purple', 'arrowLEFT'); @@ -1624,7 +1624,7 @@ class PlayState extends MusicBeatState if (storyPlaylist.length <= 0) { - FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt); + FlxG.sound.playMusic(Paths.music('freakyMenu')); FlxG.switchState(new StoryMenuState()); @@ -1661,7 +1661,7 @@ class PlayState extends MusicBeatState add(blackShit); camHUD.visible = false; - FlxG.sound.play('assets/sounds/Lights_Shut_off' + TitleState.soundExt); + FlxG.sound.play(Paths.sound('Lights_Shut_off')); } if (SONG.song.toLowerCase() == 'senpai') @@ -1750,7 +1750,7 @@ class PlayState extends MusicBeatState rating.velocity.y -= FlxG.random.int(140, 175); rating.velocity.x -= FlxG.random.int(0, 10); - var comboSpr:FlxSprite = new FlxSprite().loadGraphic('assets/images/' + pixelShitPart1 + 'combo' + pixelShitPart2 + '.png'); + var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2)); comboSpr.screenCenter(); comboSpr.x = coolText.x; comboSpr.acceleration.y = 600; @@ -1784,7 +1784,7 @@ class PlayState extends MusicBeatState var daLoop:Int = 0; for (i in seperatedScore) { - var numScore:FlxSprite = new FlxSprite().loadGraphic('assets/images/' + pixelShitPart1 + 'num' + Std.int(i) + pixelShitPart2 + '.png'); + var numScore:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'num' + Std.int(i) + pixelShitPart2)); numScore.screenCenter(); numScore.x = coolText.x + (43 * daLoop) - 90; numScore.y += 80; @@ -2048,8 +2048,8 @@ class PlayState extends MusicBeatState songScore -= 10; - FlxG.sound.play('assets/sounds/missnote' + FlxG.random.int(1, 3) + TitleState.soundExt, FlxG.random.float(0.1, 0.2)); - // FlxG.sound.play('assets/sounds/missnote1' + TitleState.soundExt, 1, false); + FlxG.sound.play(Paths.soundRandom('missnote', 1, 3), FlxG.random.float(0.1, 0.2)); + // FlxG.sound.play(Paths.sound('missnote1'), 1, false); // FlxG.log.add('played imss note'); boyfriend.stunned = true; @@ -2159,7 +2159,7 @@ class PlayState extends MusicBeatState function fastCarDrive() { - FlxG.sound.play('assets/sounds/carPass' + FlxG.random.int(0, 1) + TitleState.soundExt, 0.7); + FlxG.sound.play(Paths.soundRandom('carPass', 0, 1), 0.7); fastCar.velocity.x = (FlxG.random.int(170, 220) / FlxG.elapsed) * 3; fastCarCanDrive = false; @@ -2225,7 +2225,7 @@ class PlayState extends MusicBeatState function lightningStrikeShit():Void { - FlxG.sound.play('assets/sounds/thunder_' + FlxG.random.int(1, 2) + TitleState.soundExt); + FlxG.sound.play(Paths.soundRandom('thunder_', 1, 2)); halloweenBG.animation.play('lightning'); lightningStrikeBeat = curBeat; diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index d5787c526..73f2d2c87 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -72,7 +72,7 @@ class StoryMenuState extends MusicBeatState if (FlxG.sound.music != null) { if (!FlxG.sound.music.playing) - FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt); + FlxG.sound.playMusic(Paths.music('freakyMenu')); } persistentUpdate = persistentDraw = true; @@ -90,7 +90,7 @@ class StoryMenuState extends MusicBeatState rankText.size = scoreText.size; rankText.screenCenter(X); - var ui_tex = FlxAtlasFrames.fromSparrow('assets/images/campaign_menu_UI_assets.png', 'assets/images/campaign_menu_UI_assets.xml'); + var ui_tex = Paths.getSparrowAtlas('campaign_menu_UI_assets'); var yellowBG:FlxSprite = new FlxSprite(0, 56).makeGraphic(FlxG.width, 400, 0xFFF9CF51); grpWeekText = new FlxTypedGroup(); @@ -267,7 +267,7 @@ class StoryMenuState extends MusicBeatState if (controls.BACK && !movedBack && !selectedWeek) { - FlxG.sound.play('assets/sounds/cancelMenu' + TitleState.soundExt); + FlxG.sound.play(Paths.sound('cancelMenu')); movedBack = true; FlxG.switchState(new MainMenuState()); } @@ -285,7 +285,7 @@ class StoryMenuState extends MusicBeatState { if (stopspamming == false) { - FlxG.sound.play('assets/sounds/confirmMenu' + TitleState.soundExt); + FlxG.sound.play(Paths.sound('confirmMenu')); grpWeekText.members[curWeek].week.animation.resume(); grpWeekCharacters.members[1].animation.play('bfConfirm'); @@ -381,7 +381,7 @@ class StoryMenuState extends MusicBeatState bullShit++; } - FlxG.sound.play('assets/sounds/scrollMenu' + TitleState.soundExt); + FlxG.sound.play(Paths.sound('scrollMenu')); updateText(); } diff --git a/source/TitleState.hx b/source/TitleState.hx index 53452e45c..cfdaea54c 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -118,10 +118,10 @@ class TitleState extends MusicBeatState // https://github.com/HaxeFlixel/flixel-addons/pull/348 // var music:FlxSound = new FlxSound(); - // music.loadStream('assets/music/freakyMenu' + TitleState.soundExt); + // music.loadStream(Paths.music('freakyMenu')); // FlxG.sound.list.add(music); // music.play(); - FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt, 0); + FlxG.sound.playMusic(Paths.music('freakyMenu'), 0); FlxG.sound.music.fadeIn(4, 0, 0.7); } @@ -136,7 +136,7 @@ class TitleState extends MusicBeatState add(bg); logoBl = new FlxSprite(-150, -100); - logoBl.frames = FlxAtlasFrames.fromSparrow('assets/images/logoBumpin.png', 'assets/images/logoBumpin.xml'); + logoBl.frames = Paths.getSparrowAtlas('logoBumpin'); logoBl.antialiasing = true; logoBl.animation.addByPrefix('bump', 'logo bumpin', 24); logoBl.animation.play('bump'); @@ -145,7 +145,7 @@ class TitleState extends MusicBeatState // logoBl.color = FlxColor.BLACK; gfDance = new FlxSprite(FlxG.width * 0.4, FlxG.height * 0.07); - gfDance.frames = FlxAtlasFrames.fromSparrow('assets/images/gfDanceTitle.png', 'assets/images/gfDanceTitle.xml'); + gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle'); gfDance.animation.addByIndices('danceLeft', 'gfDance', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); gfDance.antialiasing = true; @@ -153,7 +153,7 @@ class TitleState extends MusicBeatState add(logoBl); titleText = new FlxSprite(100, FlxG.height * 0.8); - titleText.frames = FlxAtlasFrames.fromSparrow('assets/images/titleEnter.png', 'assets/images/titleEnter.xml'); + titleText.frames = Paths.getSparrowAtlas('titleEnter'); titleText.animation.addByPrefix('idle', "Press Enter to Begin", 24); titleText.animation.addByPrefix('press', "ENTER PRESSED", 24); titleText.antialiasing = true; @@ -162,7 +162,7 @@ class TitleState extends MusicBeatState // titleText.screenCenter(X); add(titleText); - var logo:FlxSprite = new FlxSprite().loadGraphic('assets/images/logo.png'); + var logo:FlxSprite = new FlxSprite().loadGraphic(Paths.image('logo')); logo.screenCenter(); logo.antialiasing = true; // add(logo); @@ -184,7 +184,7 @@ class TitleState extends MusicBeatState credTextShit.visible = false; - ngSpr = new FlxSprite(0, FlxG.height * 0.52).loadGraphic('assets/images/newgrounds_logo.png'); + ngSpr = new FlxSprite(0, FlxG.height * 0.52).loadGraphic(Paths.image('newgrounds_logo')); add(ngSpr); ngSpr.visible = false; ngSpr.setGraphicSize(Std.int(ngSpr.width * 0.8)); @@ -259,7 +259,7 @@ class TitleState extends MusicBeatState titleText.animation.play('press'); FlxG.camera.flash(FlxColor.WHITE, 1); - FlxG.sound.play('assets/sounds/confirmMenu' + TitleState.soundExt, 0.7); + FlxG.sound.play(Paths.sound('confirmMenu'), 0.7); transitioning = true; // FlxG.sound.music.stop(); @@ -280,7 +280,7 @@ class TitleState extends MusicBeatState FlxG.switchState(new MainMenuState()); } }); - // FlxG.sound.play('assets/music/titleShoot' + TitleState.soundExt, 0.7); + // FlxG.sound.play(Paths.music('titleShoot'), 0.7); } if (pressedEnter && !skippedIntro) diff --git a/source/import.hx b/source/import.hx new file mode 100644 index 000000000..e0a4198ec --- /dev/null +++ b/source/import.hx @@ -0,0 +1 @@ +import Paths; \ No newline at end of file