From a16608448dabd49ee39fa58a00141c68de6b4ac8 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Sat, 19 Nov 2022 15:23:00 +0100 Subject: [PATCH] post stuff!! also now every asset can be animated --- assets/data/charts/stress/chart.hx | 2 +- assets/data/charts/test/modchart.hx | 2 +- assets/data/scripts/pixel.hx | 4 ++-- assets/data/scripts/week6-pause.hx | 3 --- buildnumber.txt | 2 +- .../windows/bin/assets/data/charts/stress/chart.hx | 2 +- .../windows/bin/assets/data/charts/test/modchart.hx | 2 +- latest/windows/bin/assets/data/scripts/pixel.hx | 4 ++-- .../windows/bin/assets/data/scripts/week6-pause.hx | 3 --- source/funkin/game/Note.hx | 2 +- source/funkin/game/PlayState.hx | 12 ++++++------ source/funkin/menus/GitarooPause.hx | 8 ++++---- source/funkin/menus/MainMenuState.hx | 6 +++--- source/funkin/menus/StoryMenuState.hx | 2 +- source/funkin/menus/TitleState.hx | 8 ++++---- source/funkin/options/OptionsMenu.hx | 2 +- source/funkin/options/OptionsScreen.hx | 2 +- source/funkin/options/keybinds/KeybindSetting.hx | 2 +- source/funkin/options/keybinds/KeybindsOptions.hx | 4 ++-- source/funkin/options/type/Checkbox.hx | 2 +- source/funkin/system/CoolUtil.hx | 2 ++ source/funkin/ui/Alphabet.hx | 4 ++-- 22 files changed, 38 insertions(+), 42 deletions(-) diff --git a/assets/data/charts/stress/chart.hx b/assets/data/charts/stress/chart.hx index ed0f1519..eb843526 100644 --- a/assets/data/charts/stress/chart.hx +++ b/assets/data/charts/stress/chart.hx @@ -14,6 +14,6 @@ function onDadHit(event) { } } -function createPost() { +function postCreate() { generateNotes(CoolUtil.parseJson(Paths.chart('stress', 'picospeaker')).song); } \ No newline at end of file diff --git a/assets/data/charts/test/modchart.hx b/assets/data/charts/test/modchart.hx index 1b888f38..1cd8f617 100644 --- a/assets/data/charts/test/modchart.hx +++ b/assets/data/charts/test/modchart.hx @@ -5,7 +5,7 @@ function create() { enableCameraHacks = false; } -function updatePost(elapsed) { +function postUpdate(elapsed) { var sin = Math.sin(curBeatFloat * Math.PI / 2); camGame.angle = sin * -15; diff --git a/assets/data/scripts/pixel.hx b/assets/data/scripts/pixel.hx index 6e7ce20f..736fb8c9 100644 --- a/assets/data/scripts/pixel.hx +++ b/assets/data/scripts/pixel.hx @@ -76,7 +76,7 @@ function onPlayerHit(event:NoteHitEvent) { /** * CAMERA HACKS!! */ -function createPost() { +function postCreate() { if (enablePauseMenu) { PauseSubState.script = 'data/scripts/week6-pause'; } @@ -147,7 +147,7 @@ var pixellyShaders = []; // n.offset.x -= 1; // }); // } -function updatePost(elapsed) { +function postUpdate(elapsed) { for(e in pixellyCameras) { if (Std.isOfType(e, HudCamera)) e.downscroll = camHUD.downscroll; diff --git a/assets/data/scripts/week6-pause.hx b/assets/data/scripts/week6-pause.hx index b9cd269e..2303b509 100644 --- a/assets/data/scripts/week6-pause.hx +++ b/assets/data/scripts/week6-pause.hx @@ -72,9 +72,6 @@ function confText(text) { if (!isThorns) text.borderColor = 0xFF953E3E; } -function createPost() { -} - function destroy() { FlxG.cameras.remove(pauseCam); } diff --git a/buildnumber.txt b/buildnumber.txt index f699c943..64728d90 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1309 \ No newline at end of file +1311 \ No newline at end of file diff --git a/latest/windows/bin/assets/data/charts/stress/chart.hx b/latest/windows/bin/assets/data/charts/stress/chart.hx index ed0f1519..eb843526 100644 --- a/latest/windows/bin/assets/data/charts/stress/chart.hx +++ b/latest/windows/bin/assets/data/charts/stress/chart.hx @@ -14,6 +14,6 @@ function onDadHit(event) { } } -function createPost() { +function postCreate() { generateNotes(CoolUtil.parseJson(Paths.chart('stress', 'picospeaker')).song); } \ No newline at end of file diff --git a/latest/windows/bin/assets/data/charts/test/modchart.hx b/latest/windows/bin/assets/data/charts/test/modchart.hx index 1b888f38..1cd8f617 100644 --- a/latest/windows/bin/assets/data/charts/test/modchart.hx +++ b/latest/windows/bin/assets/data/charts/test/modchart.hx @@ -5,7 +5,7 @@ function create() { enableCameraHacks = false; } -function updatePost(elapsed) { +function postUpdate(elapsed) { var sin = Math.sin(curBeatFloat * Math.PI / 2); camGame.angle = sin * -15; diff --git a/latest/windows/bin/assets/data/scripts/pixel.hx b/latest/windows/bin/assets/data/scripts/pixel.hx index 6e7ce20f..736fb8c9 100644 --- a/latest/windows/bin/assets/data/scripts/pixel.hx +++ b/latest/windows/bin/assets/data/scripts/pixel.hx @@ -76,7 +76,7 @@ function onPlayerHit(event:NoteHitEvent) { /** * CAMERA HACKS!! */ -function createPost() { +function postCreate() { if (enablePauseMenu) { PauseSubState.script = 'data/scripts/week6-pause'; } @@ -147,7 +147,7 @@ var pixellyShaders = []; // n.offset.x -= 1; // }); // } -function updatePost(elapsed) { +function postUpdate(elapsed) { for(e in pixellyCameras) { if (Std.isOfType(e, HudCamera)) e.downscroll = camHUD.downscroll; diff --git a/latest/windows/bin/assets/data/scripts/week6-pause.hx b/latest/windows/bin/assets/data/scripts/week6-pause.hx index b9cd269e..2303b509 100644 --- a/latest/windows/bin/assets/data/scripts/week6-pause.hx +++ b/latest/windows/bin/assets/data/scripts/week6-pause.hx @@ -72,9 +72,6 @@ function confText(text) { if (!isThorns) text.borderColor = 0xFF953E3E; } -function createPost() { -} - function destroy() { FlxG.cameras.remove(pauseCam); } diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index 9bac6126..4a139fb7 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -106,7 +106,7 @@ class Note extends FlxSprite { // case "My Custom Note Type": // hardcoding note types default: - frames = Paths.getSparrowAtlas(event.noteSprite); + frames = Paths.getFrames(event.noteSprite); switch(event.strumID % 4) { case 0: diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index c9463f18..33e58894 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -339,7 +339,7 @@ class PlayState extends MusicBeatState FlxG.worldBounds.set(0, 0, FlxG.width, FlxG.height); - healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(Paths.image('game/healthBar')); + healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadAnimatedGraphic(Paths.image('game/healthBar')); healthBarBG.screenCenter(X); healthBarBG.scrollFactor.set(); add(healthBarBG); @@ -483,7 +483,7 @@ class PlayState extends MusicBeatState var spr = event.spritePath; if (!Assets.exists(spr)) spr = Paths.image('$spr'); - sprite = new FlxSprite().loadGraphic(spr); + sprite = new FlxSprite().loadAnimatedGraphic(spr); sprite.scrollFactor.set(); sprite.scale.set(event.scale, event.scale); sprite.updateHitbox(); @@ -1138,7 +1138,7 @@ class PlayState extends MusicBeatState }); } - + if (!inCutscene) keyShit(); @@ -1379,12 +1379,12 @@ class PlayState extends MusicBeatState songScore += score; - rating.loadGraphic(Paths.image('${event.ratingPrefix}$daRating${event.ratingSuffix}')); + rating.loadAnimatedGraphic(Paths.image('${event.ratingPrefix}$daRating${event.ratingSuffix}')); rating.acceleration.y = 550; rating.velocity.y -= FlxG.random.int(140, 175); rating.velocity.x -= FlxG.random.int(0, 10); - var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image('${event.ratingPrefix}combo${event.ratingSuffix}')); + var comboSpr:FlxSprite = new FlxSprite().loadAnimatedGraphic(Paths.image('${event.ratingPrefix}combo${event.ratingSuffix}')); comboSpr.acceleration.y = 600; comboSpr.velocity.y -= 150; comboSpr.velocity.x += FlxG.random.int(1, 10); @@ -1407,7 +1407,7 @@ class PlayState extends MusicBeatState { var e = separatedScore.charAt(i); - var numScore:FlxSprite = new FlxSprite((43 * i) - 90, 80).loadGraphic(Paths.image('${event.ratingPrefix}num$e${event.ratingSuffix}')); + var numScore:FlxSprite = new FlxSprite((43 * i) - 90, 80).loadAnimatedGraphic(Paths.image('${event.ratingPrefix}num$e${event.ratingSuffix}')); numScore.antialiasing = event.numAntialiasing; numScore.scale.set(event.numScale, event.numScale); numScore.updateHitbox(); diff --git a/source/funkin/menus/GitarooPause.hx b/source/funkin/menus/GitarooPause.hx index 18a55791..0b32c879 100644 --- a/source/funkin/menus/GitarooPause.hx +++ b/source/funkin/menus/GitarooPause.hx @@ -21,25 +21,25 @@ class GitarooPause extends MusicBeatState if (FlxG.sound.music != null) FlxG.sound.music.stop(); - var bg:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menus/pauseAlt//pauseBG')); + var bg:FlxSprite = new FlxSprite().loadAnimatedGraphic(Paths.image('menus/pauseAlt//pauseBG')); add(bg); var bf:FlxSprite = new FlxSprite(0, 30); - bf.frames = Paths.getSparrowAtlas('menus/pauseAlt//bfLol'); + bf.frames = Paths.getFrames('menus/pauseAlt//bfLol'); bf.animation.addByPrefix('lol', "funnyThing", 13); bf.animation.play('lol'); add(bf); bf.screenCenter(X); replayButton = new FlxSprite(FlxG.width * 0.28, FlxG.height * 0.7); - replayButton.frames = Paths.getSparrowAtlas('menus/pauseAlt//pauseUI'); + replayButton.frames = Paths.getFrames('menus/pauseAlt//pauseUI'); replayButton.animation.addByPrefix('selected', 'bluereplay', 0, false); replayButton.animation.appendByPrefix('selected', 'yellowreplay'); replayButton.animation.play('selected'); add(replayButton); cancelButton = new FlxSprite(FlxG.width * 0.58, replayButton.y); - cancelButton.frames = Paths.getSparrowAtlas('menus/pauseAlt//pauseUI'); + cancelButton.frames = Paths.getFrames('menus/pauseAlt//pauseUI'); cancelButton.animation.addByPrefix('selected', 'bluecancel', 0, false); cancelButton.animation.appendByPrefix('selected', 'cancelyellow'); cancelButton.animation.play('selected'); diff --git a/source/funkin/menus/MainMenuState.hx b/source/funkin/menus/MainMenuState.hx index d2b5966c..f35cc22a 100644 --- a/source/funkin/menus/MainMenuState.hx +++ b/source/funkin/menus/MainMenuState.hx @@ -54,7 +54,7 @@ class MainMenuState extends MusicBeatState persistentUpdate = persistentDraw = true; - var bg:FlxSprite = new FlxSprite(-80).loadGraphic(Paths.image('menus/menuBG')); + var bg:FlxSprite = new FlxSprite(-80).loadAnimatedGraphic(Paths.image('menus/menuBG')); bg.scrollFactor.x = 0; bg.scrollFactor.y = 0.18; bg.scale.set(1.15, 1.15); @@ -66,7 +66,7 @@ class MainMenuState extends MusicBeatState camFollow = new FlxObject(0, 0, 1, 1); add(camFollow); - magenta = new FlxSprite(-80).loadGraphic(Paths.image('menus/menuDesat')); + magenta = new FlxSprite(-80).loadAnimatedGraphic(Paths.image('menus/menuDesat')); magenta.scrollFactor.x = 0; magenta.scrollFactor.y = 0.18; magenta.scale.set(1.15, 1.15); @@ -84,7 +84,7 @@ class MainMenuState extends MusicBeatState for (i in 0...optionShit.length) { var menuItem:FlxSprite = new FlxSprite(0, 60 + (i * 160)); - menuItem.frames = Paths.getSparrowAtlas('menus/mainmenu/${optionShit[i]}'); + menuItem.frames = Paths.getFrames('menus/mainmenu/${optionShit[i]}'); menuItem.animation.addByPrefix('idle', optionShit[i] + " basic", 24); menuItem.animation.addByPrefix('selected', optionShit[i] + " white", 24); menuItem.animation.play('idle'); diff --git a/source/funkin/menus/StoryMenuState.hx b/source/funkin/menus/StoryMenuState.hx index ee2a7186..4cee34cd 100644 --- a/source/funkin/menus/StoryMenuState.hx +++ b/source/funkin/menus/StoryMenuState.hx @@ -71,7 +71,7 @@ class StoryMenuState extends MusicBeatState { weekSprites = new FlxTypedGroup(); // DUMBASS ARROWS - var assets = Paths.getSparrowAtlas('menus/storymenu/assets'); + var assets = Paths.getFrames('menus/storymenu/assets'); var directions = ["left", "right"]; leftArrow = new FlxSprite((FlxG.width + 400) / 2, weekBG.y + weekBG.height + 10 + 10); diff --git a/source/funkin/menus/TitleState.hx b/source/funkin/menus/TitleState.hx index bf8f9016..bf134068 100644 --- a/source/funkin/menus/TitleState.hx +++ b/source/funkin/menus/TitleState.hx @@ -69,14 +69,14 @@ class TitleState extends MusicBeatState add(bg); logoBl = new FlxSprite(-150, -100); - logoBl.frames = Paths.getSparrowAtlas('logoBumpin'); + logoBl.frames = Paths.getFrames('logoBumpin'); logoBl.antialiasing = true; logoBl.animation.addByPrefix('bump', 'logo bumpin', 24); logoBl.animation.play('bump'); logoBl.updateHitbox(); gfDance = new FlxSprite(FlxG.width * 0.4, FlxG.height * 0.07); - gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle'); + gfDance.frames = Paths.getFrames('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; @@ -84,7 +84,7 @@ class TitleState extends MusicBeatState add(logoBl); titleText = new FlxSprite(100, FlxG.height * 0.8); - titleText.frames = Paths.getSparrowAtlas('titleEnter'); + titleText.frames = Paths.getFrames('titleEnter'); titleText.animation.addByPrefix('idle', "Press Enter to Begin", 24); titleText.animation.addByPrefix('press', "ENTER PRESSED", 24); titleText.antialiasing = true; @@ -97,7 +97,7 @@ class TitleState extends MusicBeatState blackScreen = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); add(blackScreen); - ngSpr = new FlxSprite(0, FlxG.height * 0.52).loadGraphic(Paths.image('newgrounds_logo')); + ngSpr = new FlxSprite(0, FlxG.height * 0.52).loadAnimatedGraphic(Paths.image('newgrounds_logo')); add(ngSpr); ngSpr.visible = false; ngSpr.setGraphicSize(Std.int(ngSpr.width * 0.8)); diff --git a/source/funkin/options/OptionsMenu.hx b/source/funkin/options/OptionsMenu.hx index c47bd582..d79dae40 100644 --- a/source/funkin/options/OptionsMenu.hx +++ b/source/funkin/options/OptionsMenu.hx @@ -56,7 +56,7 @@ class OptionsMenu extends MusicBeatState { if (fromPlayState != null) OptionsMenu.fromPlayState = fromPlayState; } public override function create() { - var bg:FlxSprite = new FlxSprite(-80).loadGraphic(Paths.image('menus/menuBGBlue')); + var bg:FlxSprite = new FlxSprite(-80).loadAnimatedGraphic(Paths.image('menus/menuBGBlue')); bg.scrollFactor.set(); bg.scale.set(1.15, 1.15); bg.updateHitbox(); diff --git a/source/funkin/options/OptionsScreen.hx b/source/funkin/options/OptionsScreen.hx index c607ad42..07323b4a 100644 --- a/source/funkin/options/OptionsScreen.hx +++ b/source/funkin/options/OptionsScreen.hx @@ -43,7 +43,7 @@ class OptionsScreen extends MusicBeatState { FlxTransitionableState.skipNextTransIn = true; super.create(); - bg = new FlxSprite(-80).loadGraphic(Paths.image('menus/menuBG')); + bg = new FlxSprite(-80).loadAnimatedGraphic(Paths.image('menus/menuBG')); bg.scrollFactor.set(); bg.scale.set(1.15, 1.15); bg.updateHitbox(); diff --git a/source/funkin/options/keybinds/KeybindSetting.hx b/source/funkin/options/keybinds/KeybindSetting.hx index d0010464..95511f25 100644 --- a/source/funkin/options/keybinds/KeybindSetting.hx +++ b/source/funkin/options/keybinds/KeybindSetting.hx @@ -56,7 +56,7 @@ class KeybindSetting extends FlxTypedSpriteGroup { if (sparrowIcon != null) { icon = new FlxSprite(); - icon.frames = Paths.getSparrowAtlas(sparrowIcon); + icon.frames = Paths.getFrames(sparrowIcon); icon.antialiasing = true; icon.animation.addByPrefix('icon', sparrowAnim, 24, true); icon.animation.play('icon'); diff --git a/source/funkin/options/keybinds/KeybindsOptions.hx b/source/funkin/options/keybinds/KeybindsOptions.hx index 5c2bc9e0..42d67230 100644 --- a/source/funkin/options/keybinds/KeybindsOptions.hx +++ b/source/funkin/options/keybinds/KeybindsOptions.hx @@ -105,8 +105,8 @@ class KeybindsOptions extends MusicBeatSubstate { isSubState = FlxG.state != this; alphabets = new FlxTypedGroup(); - bg = new FlxSprite(-80).loadGraphic(Paths.image(isSubState ? 'menus/menuTransparent' : 'menus/menuBGBlue')); - coloredBG = new FlxSprite(-80).loadGraphic(Paths.image('menus/menuDesat')); + bg = new FlxSprite(-80).loadAnimatedGraphic(Paths.image(isSubState ? 'menus/menuTransparent' : 'menus/menuBGBlue')); + coloredBG = new FlxSprite(-80).loadAnimatedGraphic(Paths.image('menus/menuDesat')); for(bg in [bg, coloredBG]) { bg.scrollFactor.set(); bg.scale.set(1.15, 1.15); diff --git a/source/funkin/options/type/Checkbox.hx b/source/funkin/options/type/Checkbox.hx index bcce8f5a..8edb90bf 100644 --- a/source/funkin/options/type/Checkbox.hx +++ b/source/funkin/options/type/Checkbox.hx @@ -25,7 +25,7 @@ class Checkbox extends TextOption { super(text, desc, null); checkbox = new FlxSprite(10, -40); - checkbox.frames = Paths.getSparrowAtlas('menus/options/checkboxThingie'); + checkbox.frames = Paths.getFrames('menus/options/checkboxThingie'); checkbox.animation.addByPrefix("checked", "Check Box Selected Static", 24); checkbox.animation.addByPrefix("unchecked", "Check Box unselected", 24); checkbox.animation.addByPrefix("checking", "Check Box selecting animation", 24, false); diff --git a/source/funkin/system/CoolUtil.hx b/source/funkin/system/CoolUtil.hx index 6d2f3153..c8e2ebcf 100644 --- a/source/funkin/system/CoolUtil.hx +++ b/source/funkin/system/CoolUtil.hx @@ -317,5 +317,7 @@ class CoolUtil spr.animation.add("idle", [for(i in 0...spr.frames.frames.length) i], 24, true); spr.animation.play("idle"); } + + return spr; } } \ No newline at end of file diff --git a/source/funkin/ui/Alphabet.hx b/source/funkin/ui/Alphabet.hx index dc986fc5..0cd1364c 100644 --- a/source/funkin/ui/Alphabet.hx +++ b/source/funkin/ui/Alphabet.hx @@ -254,7 +254,7 @@ class AlphaCharacter extends FlxSprite width = 40; return; } - frames = Paths.getSparrowAtlas(boldAlphabetPath); + frames = Paths.getFrames(boldAlphabetPath); animation.addByPrefix(letter, boldAnims[letter], 24); animation.play(letter); updateHitbox(); @@ -267,7 +267,7 @@ class AlphaCharacter extends FlxSprite width = 40; return; } - frames = Paths.getSparrowAtlas(letterAlphabetPath); + frames = Paths.getFrames(letterAlphabetPath); animation.addByPrefix(letter, letterAnims[letter], 24); animation.play(letter); updateHitbox();