diff --git a/Project.xml b/Project.xml
index c6eb34e14..be1f2cbed 100644
--- a/Project.xml
+++ b/Project.xml
@@ -126,7 +126,7 @@
-
+
diff --git a/source/BGSprite.hx b/source/BGSprite.hx
index a1013b015..89bcb7f0c 100644
--- a/source/BGSprite.hx
+++ b/source/BGSprite.hx
@@ -9,7 +9,7 @@ class BGSprite extends FlxSprite
*/
public var idleAnim:String;
- public function new(image:String, x:Float = 0, y:Float = 0, parX:Float = 1, parY:Float = 1, ?daAnimations:Array)
+ public function new(image:String, x:Float = 0, y:Float = 0, parX:Float = 1, parY:Float = 1, ?daAnimations:Array, ?loopingAnim:Bool = false)
{
super(x, y);
@@ -18,7 +18,7 @@ class BGSprite extends FlxSprite
frames = Paths.getSparrowAtlas(image);
for (anims in daAnimations)
{
- animation.addByPrefix(anims, anims, 24, false);
+ animation.addByPrefix(anims, anims, 24, loopingAnim);
animation.play(anims);
if (idleAnim == null)
diff --git a/source/Character.hx b/source/Character.hx
index 860fc7317..06745f3b3 100644
--- a/source/Character.hx
+++ b/source/Character.hx
@@ -5,6 +5,7 @@ import flixel.FlxG;
import flixel.FlxSprite;
import flixel.animation.FlxBaseAnimation;
import flixel.graphics.frames.FlxAtlasFrames;
+import flixel.util.FlxSort;
import haxe.io.Path;
using StringTools;
@@ -55,7 +56,7 @@ class Character extends FlxSprite
playAnim('danceRight');
case 'gf-christmas':
- tex = Paths.getSparrowAtlas('christmas/gfChristmas');
+ tex = Paths.getSparrowAtlas('characters/gfChristmas');
frames = tex;
quickAnimAdd('cheer', 'GF Cheer');
quickAnimAdd('singLEFT', 'GF left note');
@@ -69,19 +70,7 @@ class Character extends FlxSprite
animation.addByIndices('hairFall', "GF Dancing Beat Hair Landing", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "", 24, false);
animation.addByPrefix('scared', 'GF FEAR', 24, true);
- addOffset('cheer');
- addOffset('sad', -2, -21);
- addOffset('danceLeft', 0, -9);
- addOffset('danceRight', 0, -9);
-
- addOffset("singUP", 0, 4);
- addOffset("singRIGHT", 0, -20);
- addOffset("singLEFT", 0, -19);
- addOffset("singDOWN", 0, -20);
- addOffset('hairBlow', 45, -8);
- addOffset('hairFall', 0, -9);
-
- addOffset('scared', -2, -17);
+ loadOffsetFile(curCharacter);
playAnim('danceRight');
@@ -106,7 +95,7 @@ class Character extends FlxSprite
flipX = true;
case 'gf-car':
- tex = Paths.getSparrowAtlas('gfCar');
+ tex = Paths.getSparrowAtlas('characters/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);
@@ -114,21 +103,18 @@ class Character extends FlxSprite
false);
animation.addByIndices('idleHair', 'GF Dancing Beat Hair blowing CAR', [10, 11, 12, 25, 26, 27], "", 24, true);
- addOffset('danceLeft', 0);
- addOffset('danceRight', 0);
- addOffset('idleHair', 0);
+ loadOffsetFile(curCharacter);
playAnim('danceRight');
case 'gf-pixel':
- tex = Paths.getSparrowAtlas('weeb/gfPixel');
+ tex = Paths.getSparrowAtlas('characters/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);
animation.addByIndices('danceRight', 'GF IDLE', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
- addOffset('danceLeft', 0);
- addOffset('danceRight', 0);
+ loadOffsetFile(curCharacter);
playAnim('danceRight');
@@ -138,7 +124,7 @@ class Character extends FlxSprite
case 'dad':
// DAD ANIMATION LOADING CODE
- tex = Paths.getSparrowAtlas('DADDY_DEAREST');
+ tex = Paths.getSparrowAtlas('characters/DADDY_DEAREST');
frames = tex;
quickAnimAdd('idle', 'Dad idle dance');
quickAnimAdd('singUP', 'Dad Sing Note UP');
@@ -146,15 +132,11 @@ class Character extends FlxSprite
quickAnimAdd('singDOWN', 'Dad Sing Note DOWN');
quickAnimAdd('singLEFT', 'Dad Sing Note LEFT');
- addOffset('idle');
- addOffset("singUP", -6, 50);
- addOffset("singRIGHT", 0, 27);
- addOffset("singLEFT", -10, 10);
- addOffset("singDOWN", 0, -30);
+ loadOffsetFile(curCharacter);
playAnim('idle');
case 'spooky':
- tex = Paths.getSparrowAtlas('spooky_kids_assets');
+ tex = Paths.getSparrowAtlas('characters/spooky_kids_assets');
frames = tex;
quickAnimAdd('singUP', 'spooky UP NOTE');
quickAnimAdd('singDOWN', 'spooky DOWN note');
@@ -163,17 +145,11 @@ class Character extends FlxSprite
animation.addByIndices('danceLeft', 'spooky dance idle', [0, 2, 6], "", 12, false);
animation.addByIndices('danceRight', 'spooky dance idle', [8, 10, 12, 14], "", 12, false);
- addOffset('danceLeft');
- addOffset('danceRight');
-
- addOffset("singUP", -20, 26);
- addOffset("singRIGHT", -130, -14);
- addOffset("singLEFT", 130, -10);
- addOffset("singDOWN", -50, -130);
+ loadOffsetFile(curCharacter);
playAnim('danceRight');
case 'mom':
- tex = Paths.getSparrowAtlas('Mom_Assets');
+ tex = Paths.getSparrowAtlas('characters/Mom_Assets');
frames = tex;
quickAnimAdd('idle', "Mom Idle");
@@ -184,16 +160,12 @@ class Character extends FlxSprite
// CUZ DAVE IS DUMB!
quickAnimAdd('singRIGHT', 'Mom Pose Left');
- addOffset('idle');
- addOffset("singUP", 14, 71);
- addOffset("singRIGHT", 10, -60);
- addOffset("singLEFT", 250, -23);
- addOffset("singDOWN", 20, -160);
+ loadOffsetFile(curCharacter);
playAnim('idle');
case 'mom-car':
- tex = Paths.getSparrowAtlas('momCar');
+ tex = Paths.getSparrowAtlas('characters/momCar');
frames = tex;
quickAnimAdd('idle', "Mom Idle");
@@ -205,16 +177,11 @@ class Character extends FlxSprite
quickAnimAdd('singRIGHT', 'Mom Pose Left');
animation.addByIndices('idleHair', "Mom Idle", [10, 11, 12, 13], "", 24, true);
- addOffset('idle');
- addOffset("singUP", 14, 71);
- addOffset("singRIGHT", 10, -60);
- addOffset("singLEFT", 250, -23);
- addOffset("singDOWN", 20, -160);
- addOffset('idleHair');
+ loadOffsetFile(curCharacter);
playAnim('idle');
case 'monster':
- tex = Paths.getSparrowAtlas('Monster_Assets');
+ tex = Paths.getSparrowAtlas('characters/Monster_Assets');
frames = tex;
quickAnimAdd('idle', 'monster idle');
quickAnimAdd('singUP', 'monster up note');
@@ -222,14 +189,11 @@ class Character extends FlxSprite
quickAnimAdd('singLEFT', 'Monster left note');
quickAnimAdd('singRIGHT', 'Monster Right note');
- addOffset('idle');
- addOffset("singUP", -20, 94);
- addOffset("singRIGHT", -51, 30);
- addOffset("singLEFT", -30, 20);
- addOffset("singDOWN", -50, -80);
+ loadOffsetFile(curCharacter);
+
playAnim('idle');
case 'monster-christmas':
- tex = Paths.getSparrowAtlas('christmas/monsterChristmas');
+ tex = Paths.getSparrowAtlas('characters/monsterChristmas');
frames = tex;
quickAnimAdd('idle', 'monster idle');
quickAnimAdd('singUP', 'monster up note');
@@ -237,14 +201,11 @@ class Character extends FlxSprite
quickAnimAdd('singLEFT', 'Monster left note');
quickAnimAdd('singRIGHT', 'Monster Right note');
- addOffset('idle');
- addOffset("singUP", -20, 50);
- addOffset("singRIGHT", -51);
- addOffset("singLEFT", -30);
- addOffset("singDOWN", -40, -94);
+ loadOffsetFile(curCharacter);
+
playAnim('idle');
case 'pico':
- tex = Paths.getSparrowAtlas('Pico_FNF_assetss');
+ tex = Paths.getSparrowAtlas('characters/Pico_FNF_assetss');
frames = tex;
quickAnimAdd('idle', "Pico Idle Dance");
quickAnimAdd('singUP', 'pico Up note0');
@@ -268,15 +229,7 @@ class Character extends FlxSprite
quickAnimAdd('singUPmiss', 'pico Up note miss');
quickAnimAdd('singDOWNmiss', 'Pico Down Note MISS');
- addOffset('idle');
- addOffset("singUP", -29, 27);
- addOffset("singRIGHT", -68, -7);
- addOffset("singLEFT", 65, 9);
- addOffset("singDOWN", 200, -70);
- addOffset("singUPmiss", -19, 67);
- addOffset("singRIGHTmiss", -60, 41);
- addOffset("singLEFTmiss", 62, 64);
- addOffset("singDOWNmiss", 210, -28);
+ loadOffsetFile(curCharacter);
playAnim('idle');
@@ -325,7 +278,7 @@ class Character extends FlxSprite
loadOffsetFile(curCharacter);
case 'bf-christmas':
- var tex = Paths.getSparrowAtlas('christmas/bfChristmas');
+ var tex = Paths.getSparrowAtlas('characters/bfChristmas');
frames = tex;
quickAnimAdd('idle', 'BF idle dance');
quickAnimAdd('singUP', 'BF NOTE UP0');
@@ -338,22 +291,13 @@ class Character extends FlxSprite
quickAnimAdd('singDOWNmiss', 'BF NOTE DOWN MISS');
quickAnimAdd('hey', 'BF HEY');
- addOffset('idle', -5);
- addOffset("singUP", -29, 27);
- addOffset("singRIGHT", -38, -7);
- addOffset("singLEFT", 12, -6);
- addOffset("singDOWN", -10, -50);
- addOffset("singUPmiss", -29, 27);
- addOffset("singRIGHTmiss", -30, 21);
- addOffset("singLEFTmiss", 12, 24);
- addOffset("singDOWNmiss", -11, -19);
- addOffset("hey", 7, 4);
+ loadOffsetFile(curCharacter);
playAnim('idle');
flipX = true;
case 'bf-car':
- var tex = Paths.getSparrowAtlas('bfCar');
+ var tex = Paths.getSparrowAtlas('characters/bfCar');
frames = tex;
quickAnimAdd('idle', 'BF idle dance');
quickAnimAdd('singUP', 'BF NOTE UP0');
@@ -366,21 +310,13 @@ class Character extends FlxSprite
quickAnimAdd('singDOWNmiss', 'BF NOTE DOWN MISS');
animation.addByIndices('idleHair', 'BF idle dance', [10, 11, 12, 13], "", 24, true);
- addOffset('idle', -5);
- addOffset("singUP", -29, 27);
- addOffset("singRIGHT", -38, -7);
- addOffset("singLEFT", 12, -6);
- addOffset("singDOWN", -10, -50);
- addOffset("singUPmiss", -29, 27);
- addOffset("singRIGHTmiss", -30, 21);
- addOffset("singLEFTmiss", 12, 24);
- addOffset("singDOWNmiss", -11, -19);
- addOffset('idleHair', -5);
+ loadOffsetFile(curCharacter);
+
playAnim('idle');
flipX = true;
case 'bf-pixel':
- frames = Paths.getSparrowAtlas('weeb/bfPixel');
+ frames = Paths.getSparrowAtlas('characters/bfPixel');
quickAnimAdd('idle', 'BF IDLE');
quickAnimAdd('singUP', 'BF UP NOTE');
quickAnimAdd('singLEFT', 'BF LEFT NOTE');
@@ -391,15 +327,7 @@ class Character extends FlxSprite
quickAnimAdd('singRIGHTmiss', 'BF RIGHT MISS');
quickAnimAdd('singDOWNmiss', 'BF DOWN MISS');
- addOffset('idle');
- addOffset("singUP");
- addOffset("singRIGHT");
- addOffset("singLEFT");
- addOffset("singDOWN");
- addOffset("singUPmiss");
- addOffset("singRIGHTmiss");
- addOffset("singLEFTmiss");
- addOffset("singDOWNmiss");
+ loadOffsetFile(curCharacter);
setGraphicSize(Std.int(width * 6));
updateHitbox();
@@ -413,16 +341,15 @@ class Character extends FlxSprite
flipX = true;
case 'bf-pixel-dead':
- frames = Paths.getSparrowAtlas('weeb/bfPixelsDEAD');
+ frames = Paths.getSparrowAtlas('characters/bfPixelsDEAD');
quickAnimAdd('singUP', "BF Dies pixel");
quickAnimAdd('firstDeath', "BF Dies pixel");
animation.addByPrefix('deathLoop', "Retry Loop", 24, true);
quickAnimAdd('deathConfirm', "RETRY CONFIRM");
animation.play('firstDeath');
- addOffset('firstDeath');
- addOffset('deathLoop', -30, -12);
- addOffset('deathConfirm', -30, -12);
+ loadOffsetFile(curCharacter);
+
playAnim('firstDeath');
// pixel bullshit
setGraphicSize(Std.int(width * 6));
@@ -431,7 +358,7 @@ class Character extends FlxSprite
flipX = true;
case 'senpai':
- frames = Paths.getSparrowAtlas('weeb/senpai');
+ frames = Paths.getSparrowAtlas('characters/senpai');
quickAnimAdd('idle', 'Senpai Idle');
// at framerate 16.8 animation plays over 2 beats at 144bpm,
// but if the game lags or the bpm is > 144 (mods etc.)
@@ -443,11 +370,7 @@ class Character extends FlxSprite
quickAnimAdd('singRIGHT', 'SENPAI RIGHT NOTE');
quickAnimAdd('singDOWN', 'SENPAI DOWN NOTE');
- addOffset('idle');
- addOffset("singUP", 5, 37);
- addOffset("singRIGHT");
- addOffset("singLEFT", 40);
- addOffset("singDOWN", 14);
+ loadOffsetFile(curCharacter);
playAnim('idle');
@@ -456,18 +379,15 @@ class Character extends FlxSprite
antialiasing = false;
case 'senpai-angry':
- frames = Paths.getSparrowAtlas('weeb/senpai');
+ frames = Paths.getSparrowAtlas('characters/senpai');
quickAnimAdd('idle', 'Angry Senpai Idle');
quickAnimAdd('singUP', 'Angry Senpai UP NOTE');
quickAnimAdd('singLEFT', 'Angry Senpai LEFT NOTE');
quickAnimAdd('singRIGHT', 'Angry Senpai RIGHT NOTE');
quickAnimAdd('singDOWN', 'Angry Senpai DOWN NOTE');
- addOffset('idle');
- addOffset("singUP", 5, 37);
- addOffset("singRIGHT");
- addOffset("singLEFT", 40);
- addOffset("singDOWN", 14);
+ loadOffsetFile(curCharacter);
+
playAnim('idle');
setGraphicSize(Std.int(width * 6));
@@ -476,18 +396,14 @@ class Character extends FlxSprite
antialiasing = false;
case 'spirit':
- frames = Paths.getPackerAtlas('weeb/spirit');
+ frames = Paths.getPackerAtlas('characters/spirit');
quickAnimAdd('idle', "idle spirit_");
quickAnimAdd('singUP', "up_");
quickAnimAdd('singRIGHT', "right_");
quickAnimAdd('singLEFT', "left_");
quickAnimAdd('singDOWN', "spirit down_");
- addOffset('idle', -220, -280);
- addOffset('singUP', -220, -240);
- addOffset("singRIGHT", -220, -280);
- addOffset("singLEFT", -200, -280);
- addOffset("singDOWN", 170, 110);
+ loadOffsetFile(curCharacter);
setGraphicSize(Std.int(width * 6));
updateHitbox();
@@ -497,7 +413,7 @@ class Character extends FlxSprite
antialiasing = false;
case 'parents-christmas':
- frames = Paths.getSparrowAtlas('christmas/mom_dad_christmas_assets');
+ frames = Paths.getSparrowAtlas('characters/mom_dad_christmas_assets');
quickAnimAdd('idle', 'Parent Christmas Idle');
quickAnimAdd('singUP', 'Parent Up Note Dad');
quickAnimAdd('singDOWN', 'Parent Down Note Dad');
@@ -510,15 +426,7 @@ class Character extends FlxSprite
quickAnimAdd('singLEFT-alt', 'Parent Left Note Mom');
quickAnimAdd('singRIGHT-alt', 'Parent Right Note Mom');
- addOffset('idle');
- addOffset("singUP", -47, 24);
- addOffset("singRIGHT", -1, -23);
- addOffset("singLEFT", -30, 16);
- addOffset("singDOWN", -31, -29);
- addOffset("singUP-alt", -47, 24);
- addOffset("singRIGHT-alt", -1, -24);
- addOffset("singLEFT-alt", -30, 15);
- addOffset("singDOWN-alt", -30, -27);
+ loadOffsetFile(curCharacter);
playAnim('idle');
case 'tankman':
@@ -594,7 +502,15 @@ class Character extends FlxSprite
}
}
+ TankmenBG.animationNotes = animationNotes;
+
trace(animationNotes);
+ animationNotes.sort(sortAnims);
+ }
+
+ function sortAnims(val1:Array, val2:Array):Int
+ {
+ return FlxSort.byValues(FlxSort.ASCENDING, val1[0], val2[0]);
}
function quickAnimAdd(name:String, prefix:String)
@@ -664,6 +580,11 @@ class Character extends FlxSprite
animationNotes.shift();
}
}
+
+ if (animation.curAnim.finished)
+ {
+ playAnim(animation.curAnim.name, false, false, animation.curAnim.numFrames - 3);
+ }
}
super.update(elapsed);
diff --git a/source/CoolUtil.hx b/source/CoolUtil.hx
index 8c24449bb..dea229ee4 100644
--- a/source/CoolUtil.hx
+++ b/source/CoolUtil.hx
@@ -1,5 +1,13 @@
package;
+import flixel.FlxG;
+import flixel.graphics.FlxGraphic;
+import flixel.graphics.frames.FlxAtlasFrames;
+import flixel.math.FlxPoint;
+import flixel.math.FlxRect;
+import flixel.system.FlxAssets.FlxGraphicAsset;
+import haxe.Json;
+import lime.math.Rectangle;
import lime.utils.Assets;
using StringTools;
@@ -34,4 +42,63 @@ class CoolUtil
}
return dumbArray;
}
+
+ public static function fromAnimate(Source:FlxGraphicAsset, Description:String):FlxAtlasFrames
+ {
+ var graphic:FlxGraphic = FlxG.bitmap.add(Source);
+ if (graphic == null)
+ return null;
+
+ var frames:FlxAtlasFrames = FlxAtlasFrames.findFrame(graphic);
+ if (frames != null)
+ return frames;
+
+ if (graphic == null || Description == null)
+ return null;
+
+ frames = new FlxAtlasFrames(graphic);
+
+ var data:AnimateObject;
+
+ var json:String = Description;
+
+ trace(json);
+
+ if (Assets.exists(json))
+ json = Assets.getText(json);
+
+ data = cast Json.parse(json).ATLAS;
+
+ for (sprite in data.SPRITES)
+ {
+ // probably nicer way to do this? Oh well
+ var swagSprite:AnimateSprite = sprite.SPRITE;
+
+ var rect = FlxRect.get(swagSprite.x, swagSprite.y, swagSprite.w, swagSprite.h);
+
+ var size = new Rectangle(0, 0, rect.width, rect.height);
+
+ var offset = FlxPoint.get(-size.left, -size.top);
+ var sourceSize = FlxPoint.get(size.width, size.height);
+
+ frames.addAtlasFrame(rect, sourceSize, offset, swagSprite.name);
+ }
+
+ return frames;
+ }
+}
+
+typedef AnimateObject =
+{
+ SPRITES:Array
+}
+
+typedef AnimateSprite =
+{
+ var name:String;
+ var x:Int;
+ var y:Int;
+ var w:Int;
+ var h:Int;
+ var rotated:Bool;
}
diff --git a/source/DialogueBox.hx b/source/DialogueBox.hx
index ade30a8e3..e6a7ee5ec 100644
--- a/source/DialogueBox.hx
+++ b/source/DialogueBox.hx
@@ -150,6 +150,7 @@ class DialogueBox extends FlxSpriteGroup
var dialogueOpened:Bool = false;
var dialogueStarted:Bool = false;
+ var dialogueEnded:Bool = false;
override function update(elapsed:Float)
{
@@ -180,7 +181,7 @@ class DialogueBox extends FlxSpriteGroup
dialogueStarted = true;
}
- if (FlxG.keys.justPressed.ANY && dialogueStarted == true)
+ if (FlxG.keys.justPressed.ANY && dialogueEnded)
{
remove(dialogue);
@@ -219,6 +220,8 @@ class DialogueBox extends FlxSpriteGroup
startDialogue();
}
}
+ else if (FlxG.keys.justPressed.ANY && dialogueStarted)
+ swagDialogue.skip();
super.update(elapsed);
}
@@ -239,8 +242,10 @@ class DialogueBox extends FlxSpriteGroup
{
trace("dialogue finish");
handSelect.visible = true;
+ dialogueEnded = true;
};
handSelect.visible = false;
+ dialogueEnded = false;
switch (curCharacter)
{
diff --git a/source/Discord.hx b/source/Discord.hx
index 253a4f59a..c28e5d9be 100644
--- a/source/Discord.hx
+++ b/source/Discord.hx
@@ -1,12 +1,16 @@
package;
import Sys.sleep;
-import discord_rpc.DiscordRpc;
using StringTools;
+#if discord_rpc
+import discord_rpc.DiscordRpc;
+#end
+
class DiscordClient
{
+ #if discord_rpc
public function new()
{
trace("Discord Client starting...");
@@ -22,7 +26,7 @@ class DiscordClient
{
DiscordRpc.process();
sleep(2);
- //trace("Discord Client Update");
+ // trace("Discord Client Update");
}
DiscordRpc.shutdown();
@@ -57,9 +61,9 @@ class DiscordClient
trace("Discord Client initialized");
}
- public static function changePresence(details:String, state:Null, ?smallImageKey : String, ?hasStartTimestamp : Bool, ?endTimestamp: Float)
+ public static function changePresence(details:String, state:Null, ?smallImageKey:String, ?hasStartTimestamp:Bool, ?endTimestamp:Float)
{
- var startTimestamp:Float = if(hasStartTimestamp) Date.now().getTime() else 0;
+ var startTimestamp:Float = if (hasStartTimestamp) Date.now().getTime() else 0;
if (endTimestamp > 0)
{
@@ -71,12 +75,13 @@ class DiscordClient
state: state,
largeImageKey: 'icon',
largeImageText: "Friday Night Funkin'",
- smallImageKey : smallImageKey,
+ smallImageKey: smallImageKey,
// Obtained times are in milliseconds so they are divided so Discord can use it
- startTimestamp : Std.int(startTimestamp / 1000),
- endTimestamp : Std.int(endTimestamp / 1000)
+ startTimestamp: Std.int(startTimestamp / 1000),
+ endTimestamp: Std.int(endTimestamp / 1000)
});
- //trace('Discord RPC Updated. Arguments: $details, $state, $smallImageKey, $hasStartTimestamp, $endTimestamp');
+ // trace('Discord RPC Updated. Arguments: $details, $state, $smallImageKey, $hasStartTimestamp, $endTimestamp');
}
+ #end
}
diff --git a/source/Main.hx b/source/Main.hx
index 95b4e792f..b5f1dcb87 100644
--- a/source/Main.hx
+++ b/source/Main.hx
@@ -64,6 +64,8 @@ class Main extends Sprite
var netStream:NetStream;
private var overlay:Sprite;
+ public static var fpsCounter:FPS;
+
private function setupGame():Void
{
var stageWidth:Int = Lib.current.stage.stageWidth;
@@ -85,7 +87,8 @@ class Main extends Sprite
addChild(new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen));
#if !mobile
- addChild(new FPS(10, 3, 0xFFFFFF));
+ fpsCounter = new FPS(10, 3, 0xFFFFFF);
+ addChild(fpsCounter);
#end
/*
video = new Video();
diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx
index bdcbd277c..abfc753aa 100644
--- a/source/MainMenuState.hx
+++ b/source/MainMenuState.hx
@@ -218,6 +218,7 @@ class MainMenuState extends MusicBeatState
function startExitState(state:FlxState)
{
+ menuItems.enabled = false; // disable for exit
var duration = 0.4;
menuItems.forEach(function(item)
{
@@ -241,7 +242,10 @@ class MainMenuState extends MusicBeatState
FlxG.sound.music.volume += 0.5 * FlxG.elapsed;
}
- if (menuItems.enabled && controls.BACK)
+ if (_exiting)
+ menuItems.enabled = false;
+
+ if (controls.BACK && menuItems.enabled && !menuItems.busy)
FlxG.switchState(new TitleState());
super.update(elapsed);
diff --git a/source/MusicBeatState.hx b/source/MusicBeatState.hx
index 28660b160..9442f990f 100644
--- a/source/MusicBeatState.hx
+++ b/source/MusicBeatState.hx
@@ -2,6 +2,7 @@ package;
import Conductor.BPMChangeEvent;
import flixel.FlxG;
+import flixel.FlxGame;
import flixel.addons.transition.FlxTransitionableState;
import flixel.addons.ui.FlxUIState;
import flixel.math.FlxRect;
@@ -26,7 +27,7 @@ class MusicBeatState extends FlxUIState
override function update(elapsed:Float)
{
- //everyStep();
+ // everyStep();
var oldStep:Int = curStep;
updateCurStep();
@@ -67,6 +68,6 @@ class MusicBeatState extends FlxUIState
public function beatHit():Void
{
- //do literally nothing dumbass
+ // do literally nothing dumbass
}
}
diff --git a/source/Note.hx b/source/Note.hx
index 786a23e53..d0b582e50 100644
--- a/source/Note.hx
+++ b/source/Note.hx
@@ -7,6 +7,7 @@ import flixel.math.FlxMath;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import shaderslmfao.ColorSwap;
+import ui.PreferencesMenu;
using StringTools;
@@ -144,6 +145,9 @@ class Note extends FlxSprite
noteScore * 0.2;
alpha = 0.6;
+ if (PreferencesMenu.getPref('downscroll'))
+ angle = 180;
+
x += width / 2;
switch (noteData)
diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx
index a46955902..9bf6de606 100644
--- a/source/PauseSubState.hx
+++ b/source/PauseSubState.hx
@@ -169,7 +169,10 @@ class PauseSubState extends MusicBeatSubstate
FlxG.resetState();
case "Exit to menu":
PlayState.deathCounter = 0;
- FlxG.switchState(new MainMenuState());
+ if (PlayState.isStoryMode)
+ FlxG.switchState(new StoryMenuState());
+ else
+ FlxG.switchState(new FreeplayState());
}
}
diff --git a/source/PlayState.hx b/source/PlayState.hx
index 725154eb4..0987aa96e 100644
--- a/source/PlayState.hx
+++ b/source/PlayState.hx
@@ -35,6 +35,7 @@ import flixel.util.FlxStringUtil;
import flixel.util.FlxTimer;
import haxe.Json;
import lime.utils.Assets;
+import openfl.Lib;
import openfl.display.BlendMode;
import openfl.display.StageQuality;
import openfl.filters.ShaderFilter;
@@ -148,6 +149,9 @@ class PlayState extends MusicBeatState
if (FlxG.sound.music != null)
FlxG.sound.music.stop();
+ FlxG.sound.cache(Paths.inst(PlayState.SONG.song));
+ FlxG.sound.cache(Paths.voices(PlayState.SONG.song));
+
// var gameCam:FlxCamera = FlxG.camera;
camGame = new FlxCamera();
camHUD = new FlxCamera();
@@ -156,6 +160,11 @@ class PlayState extends MusicBeatState
FlxG.cameras.reset(camGame);
FlxG.cameras.add(camHUD, false);
+ // fake notesplash cache type deal so that it loads in the graphic?
+ var noteSplash:NoteSplash = new NoteSplash(100, 100, 0);
+ add(noteSplash);
+ noteSplash.alpha = 0.1;
+
persistentUpdate = true;
persistentDraw = true;
@@ -194,7 +203,9 @@ class PlayState extends MusicBeatState
dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue'));
}
+ #if discord_rpc
initDiscord();
+ #end
switch (SONG.song.toLowerCase())
{
@@ -492,50 +503,64 @@ class PlayState extends MusicBeatState
*/
case 'guns' | 'stress' | 'ugh':
- // defaultCamZoom = 0.95;
+ defaultCamZoom = 0.90;
curStage = 'tank';
- var bg:BGSprite = new BGSprite('tankSky', 0, -200, 0, 0);
+ var bg:BGSprite = new BGSprite('tankSky', -400, -400, 0, 0);
add(bg);
- var tankSky:BGSprite = new BGSprite('tankClouds', 0, 10, 0.1, 0.1);
+ var tankSky:BGSprite = new BGSprite('tankClouds', FlxG.random.int(-700, -100), FlxG.random.int(-20, 20), 0.1, 0.1);
+ tankSky.active = true;
+ tankSky.velocity.x = FlxG.random.float(5, 15);
add(tankSky);
- var tankMountains:BGSprite = new BGSprite('tankMountains', -100, 150, 0.2, 0.2);
+ var tankMountains:BGSprite = new BGSprite('tankMountains', -200, 90, 0.2, 0.2);
+ tankMountains.setGraphicSize(Std.int(tankMountains.width * 1.1));
+ tankMountains.updateHitbox();
add(tankMountains);
- var tankBuildings:BGSprite = new BGSprite('tankBuildings', -200, 370, 0.25, 0.25);
+ var tankBuildings:BGSprite = new BGSprite('tankBuildings', -200, 200, 0.25, 0.25);
add(tankBuildings);
- var tankRuins:BGSprite = new BGSprite('tankRuins', -200, 170, 0.35, 0.35);
+ var tankRuins:BGSprite = new BGSprite('tankRuins', -200, 0, 0.35, 0.35);
add(tankRuins);
- var tankWatchtower:BGSprite = new BGSprite('tankWatchtower', 300, 50, 0.5, 0.5);
+ var smokeLeft:BGSprite = new BGSprite('smokeLeft', -200, -100, 0.4, 0.4, ['SmokeBlurLeft'], true);
+ add(smokeLeft);
+
+ var smokeRight:BGSprite = new BGSprite('smokeRight', 1100, -100, 0.4, 0.4, ['SmokeRight'], true);
+ add(smokeRight);
+
+ var tankWatchtower:BGSprite = new BGSprite('tankWatchtower', 100, 50, 0.5, 0.5);
add(tankWatchtower);
- var tankGround:BGSprite = new BGSprite('tankGround', -200, -20);
+ var tankGround:BGSprite = new BGSprite('tankGround', -420, -150);
+ tankGround.setGraphicSize(Std.int(tankGround.width * 1.15));
+ tankGround.updateHitbox();
add(tankGround);
tankmanRun = new FlxTypedGroup();
add(tankmanRun);
- var fgTank0:BGSprite = new BGSprite('tank0', -290, 400, 1.7, 1.5, ['fg']);
+ // smokeLeft.screenCenter();
+
+ var fgTank0:BGSprite = new BGSprite('tank0', -500, 650, 1.7, 1.5, ['fg']);
foregroundSprites.add(fgTank0);
- var fgTank1:BGSprite = new BGSprite('tank1', -100, 680, 2, 0.2, ['fg']);
+ var fgTank1:BGSprite = new BGSprite('tank1', -300, 700, 2, 0.2, ['fg']);
foregroundSprites.add(fgTank1);
// just called 'foreground' just cuz small inconsistency no bbiggei
- var fgTank2:BGSprite = new BGSprite('tank2', 450, 840, 1.5, 1.5, ['foreground']);
+ var fgTank2:BGSprite = new BGSprite('tank2', 450, 940, 1.5, 1.5, ['foreground']);
foregroundSprites.add(fgTank2);
- var fgTank4:BGSprite = new BGSprite('tank4', 1000, 880, 1.5, 1.5, ['fg']);
+ var fgTank4:BGSprite = new BGSprite('tank4', 1200, 1080, 1.5, 1.5, ['fg']);
foregroundSprites.add(fgTank4);
- var fgTank5:BGSprite = new BGSprite('tank5', 1400, 600, 1.5, 1.5, ['fg']);
+ var fgTank5:BGSprite = new BGSprite('tank5', 1800, 900, 1.5, 1.5, ['fg']);
foregroundSprites.add(fgTank5);
- var fgTank3:BGSprite = new BGSprite('tank3', 1300, 1130, 3.5, 2.5, ['fg']);
+ var fgTank3:BGSprite = new BGSprite('tank3', 1300, 1430, 3.5, 2.5, ['fg']);
foregroundSprites.add(fgTank3);
default:
@@ -591,6 +616,16 @@ class PlayState extends MusicBeatState
case 'pico-speaker':
gf.x -= 50;
gf.y -= 200;
+
+ for (i in 0...TankmenBG.animationNotes.length)
+ {
+ if (FlxG.random.bool(50))
+ {
+ var tankman:TankmenBG = new TankmenBG(500, 200 + FlxG.random.int(0, 150), TankmenBG.animationNotes[i][1] < 2);
+ tankman.strumTime = TankmenBG.animationNotes[i][0];
+ tankmanRun.add(tankman);
+ }
+ }
}
dad = new Character(100, 100, SONG.player2);
@@ -642,7 +677,7 @@ class PlayState extends MusicBeatState
switch (SONG.player1)
{
case "bf-holding-gf":
- boyfriend.y -= 140;
+ // boyfriend.y -= 140;
}
// REPOSITIONING PER STAGE
@@ -679,6 +714,19 @@ class PlayState extends MusicBeatState
boyfriend.y += 220;
gf.x += 180;
gf.y += 300;
+ case "tank":
+ gf.y += 10;
+ gf.x -= 30;
+ boyfriend.x += 40;
+ boyfriend.y += 0;
+ dad.y += 60;
+ dad.x -= 80;
+
+ if (gfVersion != 'pico-speaker')
+ {
+ gf.x -= 80;
+ gf.y -= 75;
+ }
}
add(gf);
@@ -701,6 +749,12 @@ class PlayState extends MusicBeatState
Conductor.songPosition = -5000;
strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10);
+
+ if (PreferencesMenu.getPref('downscroll'))
+ {
+ strumLine.y = FlxG.height - 150; // 150 just random ass number lol
+ }
+
strumLine.scrollFactor.set();
strumLineNotes = new FlxTypedGroup();
@@ -740,6 +794,9 @@ class PlayState extends MusicBeatState
healthBarBG.scrollFactor.set();
add(healthBarBG);
+ if (PreferencesMenu.getPref('downscroll'))
+ healthBarBG.y = FlxG.height * 0.1;
+
healthBar = new FlxBar(healthBarBG.x + 4, healthBarBG.y + 4, RIGHT_TO_LEFT, Std.int(healthBarBG.width - 8), Std.int(healthBarBG.height - 8), this,
'health', 0, 2);
healthBar.scrollFactor.set();
@@ -748,7 +805,7 @@ class PlayState extends MusicBeatState
add(healthBar);
scoreTxt = new FlxText(healthBarBG.x + healthBarBG.width - 190, healthBarBG.y + 30, 0, "", 20);
- scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT);
+ scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
scoreTxt.scrollFactor.set();
add(scoreTxt);
@@ -941,7 +998,7 @@ class PlayState extends MusicBeatState
});
}
- var startTimer:FlxTimer;
+ var startTimer:FlxTimer = new FlxTimer();
var perfectMode:Bool = false;
function startCountdown():Void
@@ -958,7 +1015,7 @@ class PlayState extends MusicBeatState
var swagCounter:Int = 0;
- startTimer = new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer)
+ startTimer.start(Conductor.crochet / 1000, function(tmr:FlxTimer)
{
// this just based on beatHit stuff but compact
if (swagCounter % gfSpeed == 0)
@@ -1176,11 +1233,23 @@ class PlayState extends MusicBeatState
generatedMusic = true;
}
+ // Now you are probably wondering why I made 2 of these very similar functions
+ // sortByShit(), and sortNotes(). sortNotes is meant to be used by both sortByShit(), and the notes FlxGroup
+ // sortByShit() is meant to be used only by the unspawnNotes array.
+ // and the array sorting function doesnt need that order variable thingie
+ // this is good enough for now lololol HERE IS COMMENT FOR THIS SORTA DUMB DECISION LOL
function sortByShit(Obj1:Note, Obj2:Note):Int
{
- return FlxSort.byValues(FlxSort.ASCENDING, Obj1.strumTime, Obj2.strumTime);
+ return sortNotes(FlxSort.ASCENDING, Obj1, Obj2);
}
+ function sortNotes(order:Int = FlxSort.ASCENDING, Obj1:Note, Obj2:Note)
+ {
+ return FlxSort.byValues(order, Obj1.strumTime, Obj2.strumTime);
+ }
+
+ // ^ These two sorts also look cute together ^
+
private function generateStaticArrows(player:Int):Void
{
for (i in 0...4)
@@ -1563,54 +1632,54 @@ class PlayState extends MusicBeatState
}
// better streaming of shit
- // RESET = Quick Game Over Screen
- if (controls.RESET)
+ if (!inCutscene && !_exiting)
{
- health = 0;
- trace("RESET = True");
- }
-
- #if CAN_CHEAT // brandon's a pussy
- if (controls.CHEAT)
- {
- health += 1;
- trace("User is cheating!");
- }
- #end
-
- if (health <= 0 && !practiceMode)
- {
- boyfriend.stunned = true;
-
- persistentUpdate = false;
- persistentDraw = false;
- paused = true;
-
- vocals.stop();
- FlxG.sound.music.stop();
-
- deathCounter += 1;
-
- openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
-
- // FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
-
- #if discord_rpc
- // Game Over doesn't get his own variable because it's only used here
- DiscordClient.changePresence("Game Over - " + detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
- #end
- }
-
- if (unspawnNotes[0] != null)
- {
- if (unspawnNotes[0].strumTime - Conductor.songPosition < 1500)
+ // RESET = Quick Game Over Screen
+ if (controls.RESET)
{
- var dunceNote:Note = unspawnNotes[0];
- notes.add(dunceNote);
-
- var index:Int = unspawnNotes.indexOf(dunceNote);
- unspawnNotes.splice(index, 1);
+ health = 0;
+ trace("RESET = True");
}
+
+ #if CAN_CHEAT // brandon's a pussy
+ if (controls.CHEAT)
+ {
+ health += 1;
+ trace("User is cheating!");
+ }
+ #end
+
+ if (health <= 0 && !practiceMode)
+ {
+ boyfriend.stunned = true;
+
+ persistentUpdate = false;
+ persistentDraw = false;
+ paused = true;
+
+ vocals.stop();
+ FlxG.sound.music.stop();
+
+ deathCounter += 1;
+
+ openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
+
+ // FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
+
+ #if discord_rpc
+ // Game Over doesn't get his own variable because it's only used here
+ DiscordClient.changePresence("Game Over - " + detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
+ #end
+ }
+ }
+
+ while (unspawnNotes[0] != null && unspawnNotes[0].strumTime - Conductor.songPosition < 1800 / SONG.speed)
+ {
+ var dunceNote:Note = unspawnNotes[0];
+ notes.add(dunceNote);
+
+ var index:Int = unspawnNotes.indexOf(dunceNote);
+ unspawnNotes.shift();
}
if (generatedMusic)
@@ -1628,18 +1697,45 @@ class PlayState extends MusicBeatState
daNote.active = true;
}
- daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2)));
+ var strumLineMid = strumLine.y + Note.swagWidth / 2;
- // i am so fucking sorry for this if condition
- if (daNote.isSustainNote
- && daNote.y + daNote.offset.y <= strumLine.y + Note.swagWidth / 2
- && (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit))))
+ if (PreferencesMenu.getPref('downscroll'))
{
- var swagRect = new FlxRect(0, strumLine.y + Note.swagWidth / 2 - daNote.y, daNote.width * 2, daNote.height * 2);
- swagRect.y /= daNote.scale.y;
- swagRect.height -= swagRect.y;
+ daNote.y = (strumLine.y + (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2)));
- daNote.clipRect = swagRect;
+ if (daNote.isSustainNote)
+ {
+ if (daNote.animation.curAnim.name.endsWith("end") && daNote.prevNote != null)
+ daNote.y += daNote.prevNote.height;
+ else
+ daNote.y += daNote.height / daNote.scale.y;
+
+ if ((!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit)))
+ && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= strumLineMid)
+ {
+ // div by scale because cliprect is affected by scale i THINK
+ var swagRect:FlxRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y);
+
+ swagRect.height = (strumLineMid - daNote.y) / daNote.scale.y;
+ swagRect.y = daNote.height / daNote.scale.y - swagRect.height;
+ daNote.clipRect = swagRect;
+ }
+ }
+ }
+ else
+ {
+ daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2)));
+
+ if (daNote.isSustainNote
+ && (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit)))
+ && daNote.y + daNote.offset.y * daNote.scale.y <= strumLineMid)
+ {
+ var swagRect:FlxRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y);
+
+ swagRect.y = (strumLineMid - daNote.y) / daNote.scale.y;
+ swagRect.height -= swagRect.y;
+ daNote.clipRect = swagRect;
+ }
}
if (!daNote.mustPress && daNote.wasGoodHit)
@@ -1680,7 +1776,12 @@ class PlayState extends MusicBeatState
// WIP interpolation shit? Need to fix the pause issue
// daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * PlayState.SONG.speed));
- if (daNote.y < -daNote.height)
+ var noteMiss:Bool = daNote.y < -daNote.height;
+
+ if (PreferencesMenu.getPref('downscroll'))
+ noteMiss = daNote.y > FlxG.height;
+
+ if (noteMiss)
{
if (daNote.tooLate || !daNote.wasGoodHit)
{
@@ -2014,8 +2115,18 @@ class PlayState extends MusicBeatState
{
// control arrays, order L D R U
var holdArray:Array = [controls.NOTE_LEFT, controls.NOTE_DOWN, controls.NOTE_UP, controls.NOTE_RIGHT];
- var pressArray:Array = [controls.NOTE_LEFT_P, controls.NOTE_DOWN_P, controls.NOTE_UP_P, controls.NOTE_RIGHT_P];
- var releaseArray:Array = [controls.NOTE_LEFT_R, controls.NOTE_DOWN_R, controls.NOTE_UP_R, controls.NOTE_RIGHT_R];
+ var pressArray:Array = [
+ controls.NOTE_LEFT_P,
+ controls.NOTE_DOWN_P,
+ controls.NOTE_UP_P,
+ controls.NOTE_RIGHT_P
+ ];
+ var releaseArray:Array = [
+ controls.NOTE_LEFT_R,
+ controls.NOTE_DOWN_R,
+ controls.NOTE_UP_R,
+ controls.NOTE_RIGHT_R
+ ];
// HOLDS, check for sustain notes
if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
@@ -2045,13 +2156,13 @@ class PlayState extends MusicBeatState
for (coolNote in possibleNotes)
{
if (coolNote.noteData == daNote.noteData && Math.abs(daNote.strumTime - coolNote.strumTime) < 10)
- { // if it's the same note twice at < 10ms distance, just delete it
+ { // if it's the same note twice at < 10ms distance, just delete it
// EXCEPT u cant delete it in this loop cuz it fucks with the collection lol
dumbNotes.push(daNote);
break;
}
else if (coolNote.noteData == daNote.noteData && daNote.strumTime < coolNote.strumTime)
- { // if daNote is earlier than existing note (coolNote), replace
+ { // if daNote is earlier than existing note (coolNote), replace
possibleNotes.remove(coolNote);
possibleNotes.push(daNote);
break;
@@ -2068,7 +2179,7 @@ class PlayState extends MusicBeatState
for (note in dumbNotes)
{
- FlxG.log.add("killing dumb ass note at "+note.strumTime);
+ FlxG.log.add("killing dumb ass note at " + note.strumTime);
note.kill();
notes.remove(note, true);
note.destroy();
@@ -2081,7 +2192,7 @@ class PlayState extends MusicBeatState
else if (possibleNotes.length > 0)
{
for (shit in 0...pressArray.length)
- { // if a direction is hit that shouldn't be
+ { // if a direction is hit that shouldn't be
if (pressArray[shit] && !directionList.contains(shit))
badNoteHit();
}
@@ -2318,7 +2429,8 @@ class PlayState extends MusicBeatState
override function stepHit()
{
super.stepHit();
- if (Math.abs(FlxG.sound.music.time - Conductor.songPosition) > 20 || (SONG.needsVoices && Math.abs(vocals.time - Conductor.songPosition) > 20))
+ if (Math.abs(FlxG.sound.music.time - Conductor.songPosition) > 20
+ || (SONG.needsVoices && Math.abs(vocals.time - Conductor.songPosition) > 20))
{
resyncVocals();
}
@@ -2338,7 +2450,7 @@ class PlayState extends MusicBeatState
if (generatedMusic)
{
- notes.sort(FlxSort.byY, FlxSort.DESCENDING);
+ notes.sort(sortNotes, FlxSort.DESCENDING);
}
if (SONG.notes[Math.floor(curStep / 16)] != null)
@@ -2452,17 +2564,6 @@ class PlayState extends MusicBeatState
}
}
- switch (curSong.toLowerCase())
- {
- case 'stress':
- if (FlxG.random.bool())
- {
- var tank:TankmenBG = new TankmenBG(500, 200);
- tank.strumTime = Conductor.songPosition + (Conductor.crochet * 4);
- tankmanRun.add(tank);
- }
- }
-
if (isHalloween && FlxG.random.bool(10) && curBeat > lightningStrikeBeat + lightningOffset)
{
lightningStrikeShit();
diff --git a/source/TankmenBG.hx b/source/TankmenBG.hx
index bdd56e8a3..0109b8ca5 100644
--- a/source/TankmenBG.hx
+++ b/source/TankmenBG.hx
@@ -6,13 +6,15 @@ import haxe.display.Display.Package;
class TankmenBG extends FlxSprite
{
+ public static var animationNotes:Array = [];
+
public var strumTime:Float = 0;
public var goingRight:Bool = false;
public var tankSpeed:Float = 0.7;
public var endingOffset:Float;
- public function new(x:Float, y:Float)
+ public function new(x:Float, y:Float, isGoingRight:Bool)
{
super(x, y);
@@ -24,13 +26,12 @@ class TankmenBG extends FlxSprite
animation.addByPrefix('shot', 'John', 24, false);
animation.play('run');
+ animation.curAnim.curFrame = FlxG.random.int(0, animation.curAnim.numFrames - 1);
- y += FlxG.random.int(-40, 100);
+ goingRight = isGoingRight;
+ endingOffset = FlxG.random.float(50, 200);
- goingRight = FlxG.random.bool();
- endingOffset = FlxG.random.float(0, 120);
-
- tankSpeed = FlxG.random.float(0.65, 0.8);
+ tankSpeed = FlxG.random.float(0.6, 1);
if (goingRight)
flipX = true;
diff --git a/source/TitleState.hx b/source/TitleState.hx
index bdb394bcf..f20080570 100644
--- a/source/TitleState.hx
+++ b/source/TitleState.hx
@@ -1,6 +1,5 @@
package;
-import animate.AnimationAtlas;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
@@ -53,8 +52,6 @@ class TitleState extends MusicBeatState
polymod.Polymod.init({modRoot: "mods", dirs: ['introMod'], framework: OPENFL});
#end
- AnimationAtlas.fromAnimate(Paths.image('money'), Paths.file('images/money.json'));
-
swagShader = new ColorSwap();
FlxG.sound.muteKeys = [ZERO];
@@ -65,9 +62,8 @@ class TitleState extends MusicBeatState
super.create();
- PreferencesMenu.initPrefs();
-
FlxG.save.bind('funkin', 'ninjamuffin99');
+ PreferencesMenu.initPrefs();
PlayerSettings.init();
Highscore.load();
@@ -198,6 +194,10 @@ class TitleState extends MusicBeatState
blackScreen = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
credGroup.add(blackScreen);
+ // var atlasBullShit:FlxSprite = new FlxSprite();
+ // atlasBullShit.frames = CoolUtil.fromAnimate(Paths.image('money'), Paths.file('images/money.json'));
+ // credGroup.add(atlasBullShit);
+
credTextShit = new Alphabet(0, 0, "ninjamuffin99\nPhantomArcade\nkawaisprite\nevilsk8er", true);
credTextShit.screenCenter();
diff --git a/source/animate/Animation.hx b/source/animate/Animation.hx
deleted file mode 100644
index eec2c6c60..000000000
--- a/source/animate/Animation.hx
+++ /dev/null
@@ -1,11 +0,0 @@
-package animate;
-
-import flixel.group.FlxGroup;
-
-class Aniamtion extends FlxGroup
-{
- public function new(symbolName:String, atlas:AnimationAtlas):Void
- {
- super();
- }
-}
diff --git a/source/animate/AnimationAtlas.hx b/source/animate/AnimationAtlas.hx
deleted file mode 100644
index cd87c39d0..000000000
--- a/source/animate/AnimationAtlas.hx
+++ /dev/null
@@ -1,78 +0,0 @@
-package animate;
-
-import flixel.FlxG;
-import flixel.addons.ui.FlxUIColorSwatchSelecter.SwatchGraphic;
-import flixel.graphics.FlxGraphic;
-import flixel.graphics.frames.FlxAtlasFrames;
-import flixel.math.FlxPoint;
-import flixel.math.FlxRect;
-import flixel.system.FlxAssets.FlxGraphicAsset;
-import haxe.Json;
-import openfl.Assets;
-import openfl.geom.Rectangle;
-
-class AnimationAtlas
-{
- public function new(data:Dynamic, atlas:FlxAtlasFrames):Void {}
-
- public static function fromAnimate(Source:FlxGraphicAsset, Description:String):FlxAtlasFrames
- {
- var graphic:FlxGraphic = FlxG.bitmap.add(Source);
- if (graphic == null)
- return null;
-
- var frames:FlxAtlasFrames = FlxAtlasFrames.findFrame(graphic);
- if (frames != null)
- return frames;
-
- if (graphic == null || Description == null)
- return null;
-
- frames = new FlxAtlasFrames(graphic);
-
- var data:AnimateObject;
-
- var json:String = Description;
-
- trace(json);
-
- if (Assets.exists(json))
- json = Assets.getText(json);
-
- trace(json);
-
- data = cast Json.parse(json).ATLAS;
-
- for (sprite in data.SPRITES)
- {
- // probably nicer way to do this? Oh well
- var swagSprite:AnimateSprite = sprite.SPRITE;
-
- var rect = FlxRect.get(swagSprite.x, swagSprite.y, swagSprite.w, swagSprite.h);
-
- var size = new Rectangle(0, 0, rect.width, rect.height);
-
- var offset = FlxPoint.get(-size.left, -size.top);
- var sourceSize = FlxPoint.get(size.width, size.height);
-
- frames.addAtlasFrame(rect, sourceSize, offset, swagSprite.name);
- }
-
- return frames;
- }
-}
-
-typedef AnimateObject =
-{
- SPRITES:Array
-}
-
-typedef AnimateSprite =
-{
- var name:String;
- var x:Int;
- var y:Int;
- var w:Int;
- var h:Int;
- var rotated:Bool;
-}
diff --git a/source/ui/MenuList.hx b/source/ui/MenuList.hx
index 6d20d7d82..cee2f78b4 100644
--- a/source/ui/MenuList.hx
+++ b/source/ui/MenuList.hx
@@ -24,7 +24,8 @@ class MenuTypedList extends FlxTypedGroup
var byName = new Map();
/** Set to true, internally to disable controls, without affecting vars like `enabled` */
- var busy:Bool = false;
+ public var busy(default, null):Bool = false;
+ // bit awkward because BACK is also a menu control and this doesn't affect that
public function new (navControls:NavControls = Vertical, ?wrapMode:WrapMode)
{
diff --git a/source/ui/PreferencesMenu.hx b/source/ui/PreferencesMenu.hx
index eadd31ec0..5e4cb8b85 100644
--- a/source/ui/PreferencesMenu.hx
+++ b/source/ui/PreferencesMenu.hx
@@ -24,6 +24,7 @@ class PreferencesMenu extends ui.OptionsState.Page
createPrefItem('downscroll', 'downscroll', false);
createPrefItem('flashing menu', 'flashing-menu', true);
createPrefItem('Camera Zooming on Beat', 'camera-zoom', true);
+ createPrefItem('FPS Counter', 'fps-counter', true);
}
public static function getPref(pref:String):Dynamic
@@ -37,11 +38,15 @@ class PreferencesMenu extends ui.OptionsState.Page
preferenceCheck('downscroll', false);
preferenceCheck('flashing-menu', true);
preferenceCheck('camera-zoom', true);
+ preferenceCheck('fps-counter', true);
+
+ if (!getPref('fps-counter'))
+ FlxG.stage.removeChild(Main.fpsCounter);
}
private function createPrefItem(prefName:String, prefString:String, prefValue:Dynamic):Void
{
- items.createItem(100, 100 * items.length, prefName, AtlasFont.Bold, function()
+ items.createItem(120, (120 * items.length) + 30, prefName, AtlasFont.Bold, function()
{
preferenceCheck(prefString, prefValue);
@@ -69,7 +74,7 @@ class PreferencesMenu extends ui.OptionsState.Page
function createCheckbox(prefString:String)
{
- var checkbox:CheckboxThingie = new CheckboxThingie(0, 100 * (items.length - 1), preferences.get(prefString));
+ var checkbox:CheckboxThingie = new CheckboxThingie(0, 120 * (items.length - 1), preferences.get(prefString));
checkboxes.push(checkbox);
add(checkbox);
}
@@ -84,11 +89,27 @@ class PreferencesMenu extends ui.OptionsState.Page
preferences.set(prefName, daSwap);
checkboxes[items.selectedIndex].daValue = daSwap;
trace('toggled? ' + preferences.get(prefName));
+
+ if (prefName == 'fps-counter')
+ {
+ if (getPref('fps-counter'))
+ FlxG.stage.addChild(Main.fpsCounter);
+ else
+ FlxG.stage.removeChild(Main.fpsCounter);
+ }
}
override function update(elapsed:Float)
{
super.update(elapsed);
+
+ items.forEach(function(daItem:TextMenuItem)
+ {
+ if (items.selectedItem == daItem)
+ daItem.x = 150;
+ else
+ daItem.x = 120;
+ });
}
private static function preferenceCheck(prefString:String, prefValue:Dynamic):Void