Skip to content

Commit

Permalink
nothing much
Browse files Browse the repository at this point in the history
Just cleaned up some stuff... and the entirety of PlayState.
  • Loading branch information
rodney528 committed May 8, 2024
1 parent 8f602a2 commit 60d1be8
Show file tree
Hide file tree
Showing 12 changed files with 317 additions and 561 deletions.
2 changes: 0 additions & 2 deletions source/fnf/graphics/FunkinCamera.hx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package fnf.graphics;

import flixel.math.FlxPoint;

class FunkinCamera extends FlxCamera
{
/**
Expand Down
110 changes: 55 additions & 55 deletions source/fnf/objects/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class Character extends FlxSprite {
public var stunned:Bool = false;
public var singDuration:Float = 4; // Multiplier of how long a character holds the sing pose.
public var idleSuffix:String = '';
public var danceIdle:Bool = false; // Character use "danceLeft" and "danceRight" instead of "idle".
public var danceIdle:Bool = false; // Character use 'danceLeft' and 'danceRight' instead of 'idle'.
public var preventIdle:Bool = false;

public var positionOffset = {x: 0.0, y: 0.0};
public var cameraPosition = {x: 0.0, y: 0.0};
public var positionOffset:FlxPoint = new FlxPoint();
public var cameraPosition:FlxObject = new FlxObject();

public var healthIcon:String = 'face';

Expand All @@ -31,7 +31,7 @@ class Character extends FlxSprite {
public var originalFlipX:Bool = false;
public var iconColor:FlxColor = 0xFF0000;

public function new(x:Float, y:Float, ?character:String = "bf", ?isPlayer:Bool = false) {
public function new(x:Float, y:Float, ?character:String = 'bf', ?isPlayer:Bool = false) {
super(x, y);

animOffsets = new Map<String, Array<Dynamic>>();
Expand All @@ -47,11 +47,11 @@ class Character extends FlxSprite {
quickAnimAdd('singRIGHT', 'GF Right Note');
quickAnimAdd('singUP', 'GF Up Note');
quickAnimAdd('singDOWN', 'GF Down Note');
animation.addByIndices('sad', 'gf sad', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "", 24, true);
animation.addByIndices('danceLeft', 'GF Dancing Beat', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
animation.addByIndices('danceRight', 'GF Dancing Beat', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
animation.addByIndices('hairBlow', "GF Dancing Beat Hair blowing", [0, 1, 2, 3], "", 24);
animation.addByIndices('hairFall', "GF Dancing Beat Hair Landing", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "", 24, false);
animation.addByIndices('sad', 'gf sad', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], '', 24, true);
animation.addByIndices('danceLeft', 'GF Dancing Beat', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], '', 24, false);
animation.addByIndices('danceRight', 'GF Dancing Beat', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], '', 24, false);
animation.addByIndices('hairBlow', 'GF Dancing Beat Hair blowing', [0, 1, 2, 3], '', 24);
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);

loadOffsetFile(charName);
Expand All @@ -65,21 +65,21 @@ class Character extends FlxSprite {
quickAnimAdd('singRIGHT', 'GF Right Note');
quickAnimAdd('singUP', 'GF Up Note');
quickAnimAdd('singDOWN', 'GF Down Note');
animation.addByIndices('sad', 'gf sad', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "", 24, false);
animation.addByIndices('danceLeft', 'GF Dancing Beat', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
animation.addByIndices('danceRight', 'GF Dancing Beat', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
animation.addByIndices('hairBlow', "GF Dancing Beat Hair blowing", [0, 1, 2, 3], "", 24);
animation.addByIndices('hairFall', "GF Dancing Beat Hair Landing", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "", 24, false);
animation.addByIndices('sad', 'gf sad', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], '', 24, false);
animation.addByIndices('danceLeft', 'GF Dancing Beat', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], '', 24, false);
animation.addByIndices('danceRight', 'GF Dancing Beat', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], '', 24, false);
animation.addByIndices('hairBlow', 'GF Dancing Beat Hair blowing', [0, 1, 2, 3], '', 24);
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);

loadOffsetFile(charName);

playAnim('danceRight');
case 'gf-tankmen':
frames = Paths.getSparrowAtlas('characters/gfTankmen');
animation.addByIndices('sad', 'GF Crying at Gunpoint', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "", 24, true);
animation.addByIndices('danceLeft', 'GF Dancing at Gunpoint', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
animation.addByIndices('danceRight', 'GF Dancing at Gunpoint', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
animation.addByIndices('sad', 'GF Crying at Gunpoint', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], '', 24, true);
animation.addByIndices('danceLeft', 'GF Dancing at Gunpoint', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], '', 24, false);
animation.addByIndices('danceRight', 'GF Dancing at Gunpoint', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], '', 24, false);

loadOffsetFile('gf');
playAnim('danceRight');
Expand All @@ -104,21 +104,21 @@ class Character extends FlxSprite {

case 'gf-car':
frames = Paths.getSparrowAtlas('characters/gfCar');
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);
animation.addByIndices('danceRight', 'GF Dancing Beat Hair blowing CAR', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
animation.addByIndices('danceLeft-loop', 'GF Dancing Beat Hair blowing CAR', [10, 11, 12, 25, 26, 27], "", 24, true);
animation.addByIndices('danceRight-loop', 'GF Dancing Beat Hair blowing CAR', [10, 11, 12, 25, 26, 27], "", 24, true);
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);
animation.addByIndices('danceRight', 'GF Dancing Beat Hair blowing CAR', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], '', 24, false);
animation.addByIndices('danceLeft-loop', 'GF Dancing Beat Hair blowing CAR', [10, 11, 12, 25, 26, 27], '', 24, true);
animation.addByIndices('danceRight-loop', 'GF Dancing Beat Hair blowing CAR', [10, 11, 12, 25, 26, 27], '', 24, true);

loadOffsetFile(charName);

playAnim('danceRight');

case 'gf-pixel':
frames = Paths.getSparrowAtlas('characters/gfPixel');
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);
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);

loadOffsetFile(charName);

Expand All @@ -145,18 +145,18 @@ class Character extends FlxSprite {
quickAnimAdd('singDOWN', 'spooky DOWN note');
quickAnimAdd('singLEFT', 'note sing left');
quickAnimAdd('singRIGHT', 'spooky sing right');
animation.addByIndices('danceLeft', 'spooky dance idle', [0, 2, 6], "", 12, false);
animation.addByIndices('danceRight', 'spooky dance idle', [8, 10, 12, 14], "", 12, false);
animation.addByIndices('danceLeft', 'spooky dance idle', [0, 2, 6], '', 12, false);
animation.addByIndices('danceRight', 'spooky dance idle', [8, 10, 12, 14], '', 12, false);

loadOffsetFile(charName);

playAnim('danceRight');
case 'mom':
frames = Paths.getSparrowAtlas('characters/Mom_Assets');

quickAnimAdd('idle', "Mom Idle");
quickAnimAdd('singUP', "Mom Up Pose");
quickAnimAdd('singDOWN', "MOM DOWN POSE");
quickAnimAdd('idle', 'Mom Idle');
quickAnimAdd('singUP', 'Mom Up Pose');
quickAnimAdd('singDOWN', 'MOM DOWN POSE');
quickAnimAdd('singLEFT', 'Mom Left Pose');
// ANIMATION IS CALLED MOM LEFT POSE BUT ITS FOR THE RIGHT
// CUZ DAVE IS DUMB!
Expand All @@ -169,14 +169,14 @@ class Character extends FlxSprite {
case 'mom-car':
frames = Paths.getSparrowAtlas('characters/momCar');

quickAnimAdd('idle', "Mom Idle");
quickAnimAdd('singUP', "Mom Up Pose");
quickAnimAdd('singDOWN', "MOM DOWN POSE");
quickAnimAdd('idle', 'Mom Idle');
quickAnimAdd('singUP', 'Mom Up Pose');
quickAnimAdd('singDOWN', 'MOM DOWN POSE');
quickAnimAdd('singLEFT', 'Mom Left Pose');
// ANIMATION IS CALLED MOM LEFT POSE BUT ITS FOR THE RIGHT
// CUZ DAVE IS DUMB!
quickAnimAdd('singRIGHT', 'Mom Pose Left');
animation.addByIndices('idle-loop', "Mom Idle", [10, 11, 12, 13], "", 24, true);
animation.addByIndices('idle-loop', 'Mom Idle', [10, 11, 12, 13], '', 24, true);

loadOffsetFile(charName);

Expand Down Expand Up @@ -205,7 +205,7 @@ class Character extends FlxSprite {
playAnim('idle');
case 'pico':
frames = Paths.getSparrowAtlas('characters/Pico_FNF_assetss');
quickAnimAdd('idle', "Pico Idle Dance", true);
quickAnimAdd('idle', 'Pico Idle Dance', true);
quickAnimAdd('singUP', 'pico Up note0', true);
quickAnimAdd('singDOWN', 'Pico Down Note0', true);
if (isPlayer) {
Expand All @@ -231,10 +231,10 @@ class Character extends FlxSprite {
case 'pico-speaker':
frames = Paths.getSparrowAtlas('characters/picoSpeaker');

quickAnimAdd('shoot1', "Pico shoot 1");
quickAnimAdd('shoot2', "Pico shoot 2");
quickAnimAdd('shoot3', "Pico shoot 3");
quickAnimAdd('shoot4', "Pico shoot 4");
quickAnimAdd('shoot1', 'Pico shoot 1');
quickAnimAdd('shoot2', 'Pico shoot 2');
quickAnimAdd('shoot3', 'Pico shoot 3');
quickAnimAdd('shoot4', 'Pico shoot 4');

// here for now, will be replaced later for less copypaste
loadOffsetFile(charName);
Expand All @@ -255,9 +255,9 @@ class Character extends FlxSprite {
quickAnimAdd('singDOWNmiss', 'BF NOTE DOWN MISS', true);
quickAnimAdd('hey', 'BF HEY', true);

quickAnimAdd('firstDeath', "BF dies", true);
animation.addByPrefix('deathLoop', "BF Dead Loop", 24, false, true);
quickAnimAdd('deathConfirm', "BF Dead confirm", true);
quickAnimAdd('firstDeath', 'BF dies', true);
animation.addByPrefix('deathLoop', 'BF Dead Loop', 24, false, true);
quickAnimAdd('deathConfirm', 'BF Dead confirm', true);

animation.addByPrefix('scared', 'BF idle shaking', 24, true, true);

Expand Down Expand Up @@ -295,7 +295,7 @@ class Character extends FlxSprite {
quickAnimAdd('singLEFTmiss', 'BF NOTE LEFT MISS', true);
quickAnimAdd('singRIGHTmiss', 'BF NOTE RIGHT MISS', true);
quickAnimAdd('singDOWNmiss', 'BF NOTE DOWN MISS', true);
animation.addByIndices('idle-loop', 'BF idle dance', [10, 11, 12, 13], "", 24, true, true);
animation.addByIndices('idle-loop', 'BF idle dance', [10, 11, 12, 13], '', 24, true, true);

loadOffsetFile(charName);

Expand Down Expand Up @@ -326,10 +326,10 @@ class Character extends FlxSprite {
antialiasing = false;
case 'bf-pixel-dead':
frames = Paths.getSparrowAtlas('characters/bfPixelsDEAD');
quickAnimAdd('singUP', "BF Dies pixel", true);
quickAnimAdd('firstDeath', "BF Dies pixel", true);
animation.addByPrefix('deathLoop', "Retry Loop", 24, false, true);
quickAnimAdd('deathConfirm', "RETRY CONFIRM", true);
quickAnimAdd('singUP', 'BF Dies pixel', true);
quickAnimAdd('firstDeath', 'BF Dies pixel', true);
animation.addByPrefix('deathLoop', 'Retry Loop', 24, false, true);
quickAnimAdd('deathConfirm', 'RETRY CONFIRM', true);
animation.play('firstDeath');

loadOffsetFile(charName);
Expand Down Expand Up @@ -392,11 +392,11 @@ class Character extends FlxSprite {

case 'spirit':
frames = Paths.getPackerAtlas('characters/spirit');
quickAnimAdd('idle', "idle spirit_");
quickAnimAdd('singUP', "up_");
quickAnimAdd('singRIGHT', "right_");
quickAnimAdd('singLEFT', "left_");
quickAnimAdd('singDOWN', "spirit down_");
quickAnimAdd('idle', 'idle spirit_');
quickAnimAdd('singUP', 'up_');
quickAnimAdd('singRIGHT', 'right_');
quickAnimAdd('singLEFT', 'left_');
quickAnimAdd('singDOWN', 'spirit down_');

loadOffsetFile(charName);

Expand Down Expand Up @@ -427,7 +427,7 @@ class Character extends FlxSprite {
case 'tankman':
frames = Paths.getSparrowAtlas('characters/tankmanCaptain');

quickAnimAdd('idle', "Tankman Idle Dance", true);
quickAnimAdd('idle', 'Tankman Idle Dance', true);

if (isPlayer) {
quickAnimAdd('singLEFT', 'Tankman Note Left ', true);
Expand Down Expand Up @@ -494,11 +494,11 @@ class Character extends FlxSprite {
}

private function loadOffsetFile(offsetCharacter:String) {
var daFile:Array<String> = CoolUtil.coolTextFile(Paths.file("images/characters/" + offsetCharacter + "Offsets.txt"));
var daFile:Array<String> = CoolUtil.coolTextFile(Paths.file('images/characters/' + offsetCharacter + 'Offsets.txt'));

for (i in daFile)
{
var splitWords:Array<String> = i.split(" ");
var splitWords:Array<String> = i.split(' ');
addOffset(splitWords[0], Std.parseInt(splitWords[1]), Std.parseInt(splitWords[2]));
}
}
Expand Down
26 changes: 10 additions & 16 deletions source/fnf/objects/note/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ class Note extends FlxSprite {

public static var swagWidth:Float = 160 * 0.7;

var __state(default, set):String = '';
private function set___state(value:String):String {
__state = value;
animation.play(__state);
return value;
}
public var noteState(get, never):String;
private function get_noteState():String return __state == '' ? (isSustainNote ? 'hold' : 'note') : __state; // did some jic stuff

private var col(get, never):String;
private function get_col():String return ['purple', 'blue', 'green', 'red'][noteData];
private var dir(get, never):String;
private function get_dir():String return ['left', 'down', 'up', 'right'][noteData];

var __state:String = '';
public var noteState(get, never):String;
private function get_noteState():String return __state == '' ? (isSustainNote ? 'hold' : 'note') : __state; // did some jic stuff
public function refreshAnim() animation.play(noteState);

public function new(time:Float, data:Int, ?prev:Note, ?isSustain:Bool = false) {
super();

Expand All @@ -52,7 +55,6 @@ class Note extends FlxSprite {

switch (PlayState.curStage) {
case 'school' | 'schoolEvil':

if (isSustain) {
loadGraphic(Paths.image('weeb/pixelUI/arrowEnds'), true, 7, 6);
animation.add('end', [data + 4], 24);
Expand Down Expand Up @@ -83,10 +85,7 @@ class Note extends FlxSprite {
shader = colorSwap.shader;

x += swagWidth * data;
if (!isSustain) {
animation.play('note');
__state = 'note';
}
if (!isSustain) __state = 'note';

if (isSustain && prev != null) {
noteScore * 0.2;
Expand All @@ -96,7 +95,6 @@ class Note extends FlxSprite {

x += width / 2;

animation.play('end');
__state = 'end';

updateHitbox();
Expand All @@ -106,15 +104,11 @@ class Note extends FlxSprite {
if (PlayState.curStage.startsWith('school')) x += 30;

if (prev.isSustainNote) {
prev.animation.play('hold');
prev.__state = 'hold';
prev.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed;
prev.updateHitbox();
}
}

if (prev != null) prev.refreshAnim();
refreshAnim();
}

override function update(elapsed:Float) {
Expand Down
14 changes: 5 additions & 9 deletions source/fnf/objects/note/Strum.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,21 @@ package fnf.objects.note;
import fnf.graphics.shaders.ColorSwap;

class Strum extends FlxSprite {
var isPixel:Bool = false;
var pixelZoom:Float = 6;
public var noteData:Int;
public var noteData:Int = 0;
public var colorSwap:ColorSwap;

private var col(get, never):String;
private function get_col():String return ['purple', 'blue', 'green', 'red'][noteData];
private var dir(get, never):String;
private function get_dir():String return ['left', 'down', 'up', 'right'][noteData];

override public function new(x:Float, y:Float, data:Int, pixel:Bool = false) {
super(x, y);

colorSwap = new ColorSwap();
shader = colorSwap.shader;
noteData = data;
isPixel = pixel;

if (isPixel) {
if (pixel) {
loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels'), true, 17, 17);

animation.add('note', [data + 4]);
Expand All @@ -31,7 +27,7 @@ class Strum extends FlxSprite {
animation.add('confirm', [data + 12, data + 16], 24, false);

antialiasing = false;
setGraphicSize(Std.int(width * pixelZoom));
setGraphicSize(Std.int(width * PlayState.daPixelZoom));
updateHitbox();
} else {
frames = Paths.getSparrowAtlas('NOTE_assets');
Expand Down Expand Up @@ -61,8 +57,8 @@ class Strum extends FlxSprite {

}

public function playAnim(name:String, force:Bool = false, reverse:Bool = false, frame:Int = 0):Void {
animation.play(name, force, reverse, frame);
public function playAnim(name:String, force:Bool = false) {
animation.play(name, force);
centerOffsets();
centerOrigin();
}
Expand Down
2 changes: 1 addition & 1 deletion source/fnf/objects/note/StrumGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class StrumGroup extends FlxTypedGroup<Strum> {
babyArrow.ID = i;
if (hate == null) {
babyArrow.x = x - (Note.swagWidth / 2);
babyArrow.x += Note.swagWidth * babyArrow.noteData;
babyArrow.x += Note.swagWidth * i;
babyArrow.x -= (Note.swagWidth * ((length - 1) / 2));
} else {
babyArrow.x += 50;
Expand Down
Loading

0 comments on commit 60d1be8

Please sign in to comment.