mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
703 lines
21 KiB
Haxe
703 lines
21 KiB
Haxe
package;
|
|
|
|
import flixel.FlxG;
|
|
import flixel.FlxSprite;
|
|
import flixel.animation.FlxBaseAnimation;
|
|
import flixel.graphics.frames.FlxAtlasFrames;
|
|
import haxe.io.Path;
|
|
|
|
using StringTools;
|
|
|
|
class Character extends FlxSprite
|
|
{
|
|
public var animOffsets:Map<String, Array<Dynamic>>;
|
|
public var debugMode:Bool = false;
|
|
|
|
public var isPlayer:Bool = false;
|
|
public var curCharacter:String = 'bf';
|
|
|
|
public var holdTimer:Float = 0;
|
|
|
|
public function new(x:Float, y:Float, ?character:String = "bf", ?isPlayer:Bool = false)
|
|
{
|
|
super(x, y);
|
|
|
|
animOffsets = new Map<String, Array<Dynamic>>();
|
|
curCharacter = character;
|
|
this.isPlayer = isPlayer;
|
|
|
|
var tex:FlxAtlasFrames;
|
|
antialiasing = true;
|
|
|
|
switch (curCharacter)
|
|
{
|
|
case 'gf':
|
|
// GIRLFRIEND CODE
|
|
tex = Paths.getSparrowAtlas('characters/GF_assets');
|
|
frames = tex;
|
|
quickAnimAdd('cheer', 'GF Cheer');
|
|
quickAnimAdd('singLEFT', 'GF left note');
|
|
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.addByPrefix('scared', 'GF FEAR', 24, true);
|
|
|
|
loadOffsetFile(curCharacter);
|
|
|
|
playAnim('danceRight');
|
|
|
|
case 'gf-christmas':
|
|
tex = Paths.getSparrowAtlas('christmas/gfChristmas');
|
|
frames = tex;
|
|
quickAnimAdd('cheer', 'GF Cheer');
|
|
quickAnimAdd('singLEFT', 'GF left note');
|
|
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.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);
|
|
|
|
playAnim('danceRight');
|
|
|
|
case 'bf-holding-gf':
|
|
frames = Paths.getSparrowAtlas('characters/bfAndGF');
|
|
quickAnimAdd('idle', 'BF idle dance');
|
|
quickAnimAdd('singDOWN', 'BF NOTE DOWN0');
|
|
quickAnimAdd('singLEFT', 'BF NOTE LEFT0');
|
|
quickAnimAdd('singRIGHT', 'BF NOTE RIGHT0');
|
|
quickAnimAdd('singUP', 'BF NOTE UP0');
|
|
|
|
quickAnimAdd('singDOWNmiss', 'BF NOTE DOWN MISS');
|
|
quickAnimAdd('singLEFTmiss', 'BF NOTE LEFT MISS');
|
|
quickAnimAdd('singRIGHTmiss', 'BF NOTE RIGHT MISS');
|
|
quickAnimAdd('singUPmiss', 'BF NOTE UP MISS');
|
|
quickAnimAdd('bfCatch', 'BF catches GF');
|
|
|
|
loadOffsetFile(curCharacter);
|
|
|
|
playAnim('idle');
|
|
|
|
flipX = true;
|
|
|
|
case 'gf-car':
|
|
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);
|
|
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('idleHair', 'GF Dancing Beat Hair blowing CAR', [10, 11, 12, 25, 26, 27], "", 24, true);
|
|
|
|
addOffset('danceLeft', 0);
|
|
addOffset('danceRight', 0);
|
|
addOffset('idleHair', 0);
|
|
|
|
playAnim('danceRight');
|
|
|
|
case 'gf-pixel':
|
|
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);
|
|
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);
|
|
|
|
playAnim('danceRight');
|
|
|
|
setGraphicSize(Std.int(width * PlayState.daPixelZoom));
|
|
updateHitbox();
|
|
antialiasing = false;
|
|
|
|
case 'dad':
|
|
// DAD ANIMATION LOADING CODE
|
|
tex = Paths.getSparrowAtlas('DADDY_DEAREST');
|
|
frames = tex;
|
|
quickAnimAdd('idle', 'Dad idle dance');
|
|
quickAnimAdd('singUP', 'Dad Sing Note UP');
|
|
quickAnimAdd('singRIGHT', 'Dad Sing Note RIGHT');
|
|
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);
|
|
|
|
playAnim('idle');
|
|
case 'spooky':
|
|
tex = Paths.getSparrowAtlas('spooky_kids_assets');
|
|
frames = tex;
|
|
quickAnimAdd('singUP', 'spooky UP NOTE');
|
|
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);
|
|
|
|
addOffset('danceLeft');
|
|
addOffset('danceRight');
|
|
|
|
addOffset("singUP", -20, 26);
|
|
addOffset("singRIGHT", -130, -14);
|
|
addOffset("singLEFT", 130, -10);
|
|
addOffset("singDOWN", -50, -130);
|
|
|
|
playAnim('danceRight');
|
|
case 'mom':
|
|
tex = Paths.getSparrowAtlas('Mom_Assets');
|
|
frames = tex;
|
|
|
|
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');
|
|
|
|
addOffset('idle');
|
|
addOffset("singUP", 14, 71);
|
|
addOffset("singRIGHT", 10, -60);
|
|
addOffset("singLEFT", 250, -23);
|
|
addOffset("singDOWN", 20, -160);
|
|
|
|
playAnim('idle');
|
|
|
|
case 'mom-car':
|
|
tex = Paths.getSparrowAtlas('momCar');
|
|
frames = tex;
|
|
|
|
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('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');
|
|
|
|
playAnim('idle');
|
|
case 'monster':
|
|
tex = Paths.getSparrowAtlas('Monster_Assets');
|
|
frames = tex;
|
|
quickAnimAdd('idle', 'monster idle');
|
|
quickAnimAdd('singUP', 'monster up note');
|
|
quickAnimAdd('singDOWN', 'monster down');
|
|
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);
|
|
playAnim('idle');
|
|
case 'monster-christmas':
|
|
tex = Paths.getSparrowAtlas('christmas/monsterChristmas');
|
|
frames = tex;
|
|
quickAnimAdd('idle', 'monster idle');
|
|
quickAnimAdd('singUP', 'monster up note');
|
|
quickAnimAdd('singDOWN', 'monster down');
|
|
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);
|
|
playAnim('idle');
|
|
case 'pico':
|
|
tex = Paths.getSparrowAtlas('Pico_FNF_assetss');
|
|
frames = tex;
|
|
quickAnimAdd('idle', "Pico Idle Dance");
|
|
quickAnimAdd('singUP', 'pico Up note0');
|
|
quickAnimAdd('singDOWN', 'Pico Down Note0');
|
|
if (isPlayer)
|
|
{
|
|
quickAnimAdd('singLEFT', 'Pico NOTE LEFT0');
|
|
quickAnimAdd('singRIGHT', 'Pico Note Right0');
|
|
quickAnimAdd('singRIGHTmiss', 'Pico Note Right Miss');
|
|
quickAnimAdd('singLEFTmiss', 'Pico NOTE LEFT miss');
|
|
}
|
|
else
|
|
{
|
|
// Need to be flipped! REDO THIS LATER!
|
|
quickAnimAdd('singLEFT', 'Pico Note Right0');
|
|
quickAnimAdd('singRIGHT', 'Pico NOTE LEFT0');
|
|
quickAnimAdd('singRIGHTmiss', 'Pico NOTE LEFT miss');
|
|
quickAnimAdd('singLEFTmiss', 'Pico Note Right Miss');
|
|
}
|
|
|
|
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);
|
|
|
|
playAnim('idle');
|
|
|
|
flipX = true;
|
|
|
|
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");
|
|
|
|
// here for now, will be replaced later for less copypaste
|
|
loadOffsetFile(curCharacter);
|
|
playAnim('shoot1');
|
|
|
|
case 'bf':
|
|
var tex = Paths.getSparrowAtlas('characters/BOYFRIEND');
|
|
frames = tex;
|
|
quickAnimAdd('idle', 'BF idle dance');
|
|
quickAnimAdd('singUP', 'BF NOTE UP0');
|
|
quickAnimAdd('singLEFT', 'BF NOTE LEFT0');
|
|
quickAnimAdd('singRIGHT', 'BF NOTE RIGHT0');
|
|
quickAnimAdd('singDOWN', 'BF NOTE DOWN0');
|
|
quickAnimAdd('singUPmiss', 'BF NOTE UP MISS');
|
|
quickAnimAdd('singLEFTmiss', 'BF NOTE LEFT MISS');
|
|
quickAnimAdd('singRIGHTmiss', 'BF NOTE RIGHT MISS');
|
|
quickAnimAdd('singDOWNmiss', 'BF NOTE DOWN MISS');
|
|
quickAnimAdd('hey', 'BF HEY');
|
|
|
|
quickAnimAdd('firstDeath', "BF dies");
|
|
animation.addByPrefix('deathLoop', "BF Dead Loop", 24, true);
|
|
quickAnimAdd('deathConfirm', "BF Dead confirm");
|
|
|
|
animation.addByPrefix('scared', 'BF idle shaking', 24, true);
|
|
|
|
loadOffsetFile(curCharacter);
|
|
|
|
playAnim('idle');
|
|
|
|
flipX = true;
|
|
|
|
loadOffsetFile(curCharacter);
|
|
|
|
case 'bf-christmas':
|
|
var tex = Paths.getSparrowAtlas('christmas/bfChristmas');
|
|
frames = tex;
|
|
quickAnimAdd('idle', 'BF idle dance');
|
|
quickAnimAdd('singUP', 'BF NOTE UP0');
|
|
quickAnimAdd('singLEFT', 'BF NOTE LEFT0');
|
|
quickAnimAdd('singRIGHT', 'BF NOTE RIGHT0');
|
|
quickAnimAdd('singDOWN', 'BF NOTE DOWN0');
|
|
quickAnimAdd('singUPmiss', 'BF NOTE UP MISS');
|
|
quickAnimAdd('singLEFTmiss', 'BF NOTE LEFT MISS');
|
|
quickAnimAdd('singRIGHTmiss', 'BF NOTE RIGHT MISS');
|
|
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);
|
|
|
|
playAnim('idle');
|
|
|
|
flipX = true;
|
|
case 'bf-car':
|
|
var tex = Paths.getSparrowAtlas('bfCar');
|
|
frames = tex;
|
|
quickAnimAdd('idle', 'BF idle dance');
|
|
quickAnimAdd('singUP', 'BF NOTE UP0');
|
|
quickAnimAdd('singLEFT', 'BF NOTE LEFT0');
|
|
quickAnimAdd('singRIGHT', 'BF NOTE RIGHT0');
|
|
quickAnimAdd('singDOWN', 'BF NOTE DOWN0');
|
|
quickAnimAdd('singUPmiss', 'BF NOTE UP MISS');
|
|
quickAnimAdd('singLEFTmiss', 'BF NOTE LEFT MISS');
|
|
quickAnimAdd('singRIGHTmiss', 'BF NOTE RIGHT MISS');
|
|
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);
|
|
playAnim('idle');
|
|
|
|
flipX = true;
|
|
case 'bf-pixel':
|
|
frames = Paths.getSparrowAtlas('weeb/bfPixel');
|
|
quickAnimAdd('idle', 'BF IDLE');
|
|
quickAnimAdd('singUP', 'BF UP NOTE');
|
|
quickAnimAdd('singLEFT', 'BF LEFT NOTE');
|
|
quickAnimAdd('singRIGHT', 'BF RIGHT NOTE');
|
|
quickAnimAdd('singDOWN', 'BF DOWN NOTE');
|
|
quickAnimAdd('singUPmiss', 'BF UP MISS');
|
|
quickAnimAdd('singLEFTmiss', 'BF LEFT MISS');
|
|
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");
|
|
|
|
setGraphicSize(Std.int(width * 6));
|
|
updateHitbox();
|
|
|
|
playAnim('idle');
|
|
|
|
width -= 100;
|
|
height -= 100;
|
|
|
|
antialiasing = false;
|
|
|
|
flipX = true;
|
|
case 'bf-pixel-dead':
|
|
frames = Paths.getSparrowAtlas('weeb/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);
|
|
playAnim('firstDeath');
|
|
// pixel bullshit
|
|
setGraphicSize(Std.int(width * 6));
|
|
updateHitbox();
|
|
antialiasing = false;
|
|
flipX = true;
|
|
|
|
case 'senpai':
|
|
frames = Paths.getSparrowAtlas('weeb/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.)
|
|
// he may miss his next dance
|
|
// animation.getByName('idle').frameRate = 16.8;
|
|
|
|
quickAnimAdd('singUP', 'SENPAI UP NOTE');
|
|
quickAnimAdd('singLEFT', 'SENPAI LEFT NOTE');
|
|
quickAnimAdd('singRIGHT', 'SENPAI RIGHT NOTE');
|
|
quickAnimAdd('singDOWN', 'SENPAI DOWN NOTE');
|
|
|
|
addOffset('idle');
|
|
addOffset("singUP", 5, 37);
|
|
addOffset("singRIGHT");
|
|
addOffset("singLEFT", 40);
|
|
addOffset("singDOWN", 14);
|
|
|
|
playAnim('idle');
|
|
|
|
setGraphicSize(Std.int(width * 6));
|
|
updateHitbox();
|
|
|
|
antialiasing = false;
|
|
case 'senpai-angry':
|
|
frames = Paths.getSparrowAtlas('weeb/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);
|
|
playAnim('idle');
|
|
|
|
setGraphicSize(Std.int(width * 6));
|
|
updateHitbox();
|
|
|
|
antialiasing = false;
|
|
|
|
case 'spirit':
|
|
frames = Paths.getPackerAtlas('weeb/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);
|
|
|
|
setGraphicSize(Std.int(width * 6));
|
|
updateHitbox();
|
|
|
|
playAnim('idle');
|
|
|
|
antialiasing = false;
|
|
|
|
case 'parents-christmas':
|
|
frames = Paths.getSparrowAtlas('christmas/mom_dad_christmas_assets');
|
|
quickAnimAdd('idle', 'Parent Christmas Idle');
|
|
quickAnimAdd('singUP', 'Parent Up Note Dad');
|
|
quickAnimAdd('singDOWN', 'Parent Down Note Dad');
|
|
quickAnimAdd('singLEFT', 'Parent Left Note Dad');
|
|
quickAnimAdd('singRIGHT', 'Parent Right Note Dad');
|
|
|
|
quickAnimAdd('singUP-alt', 'Parent Up Note Mom');
|
|
|
|
quickAnimAdd('singDOWN-alt', 'Parent Down Note Mom');
|
|
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);
|
|
|
|
playAnim('idle');
|
|
case 'tankman':
|
|
frames = Paths.getSparrowAtlas('characters/tankmanCaptain');
|
|
|
|
quickAnimAdd('idle', "Tankman Idle Dance");
|
|
|
|
if (isPlayer)
|
|
{
|
|
quickAnimAdd('singLEFT', 'Tankman Note Left0');
|
|
quickAnimAdd('singRIGHT', 'Tankman Right Note0');
|
|
quickAnimAdd('singLEFTmiss', 'Tankman Note Left MISS');
|
|
quickAnimAdd('singRIGHTmiss', 'Tankman Right Note MISS');
|
|
}
|
|
else
|
|
{
|
|
// Need to be flipped! REDO THIS LATER
|
|
quickAnimAdd('singLEFT', 'Tankman Right Note0');
|
|
quickAnimAdd('singRIGHT', 'Tankman Note Left0');
|
|
quickAnimAdd('singLEFTmiss', 'Tankman Right Note MISS');
|
|
quickAnimAdd('singRIGHTmiss', 'Tankman Note Left MISS');
|
|
}
|
|
|
|
quickAnimAdd('singUP', 'Tankman UP note0');
|
|
quickAnimAdd('singDOWN', 'Tankman DOWN note0');
|
|
quickAnimAdd('singUPmiss', 'Tankman UP note MISS');
|
|
quickAnimAdd('singDOWNmiss', 'Tankman DOWN note MISS');
|
|
|
|
loadOffsetFile(curCharacter);
|
|
|
|
playAnim('idle');
|
|
|
|
flipX = true;
|
|
}
|
|
|
|
dance();
|
|
animation.finish();
|
|
|
|
if (isPlayer)
|
|
{
|
|
flipX = !flipX;
|
|
|
|
// Doesn't flip for BF, since his are already in the right place???
|
|
if (!curCharacter.startsWith('bf'))
|
|
{
|
|
// var animArray
|
|
var oldRight = animation.getByName('singRIGHT').frames;
|
|
animation.getByName('singRIGHT').frames = animation.getByName('singLEFT').frames;
|
|
animation.getByName('singLEFT').frames = oldRight;
|
|
|
|
// IF THEY HAVE MISS ANIMATIONS??
|
|
if (animation.getByName('singRIGHTmiss') != null)
|
|
{
|
|
var oldMiss = animation.getByName('singRIGHTmiss').frames;
|
|
animation.getByName('singRIGHTmiss').frames = animation.getByName('singLEFTmiss').frames;
|
|
animation.getByName('singLEFTmiss').frames = oldMiss;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function quickAnimAdd(name:String, prefix:String)
|
|
{
|
|
animation.addByPrefix(name, prefix, 24, false);
|
|
}
|
|
|
|
private function loadOffsetFile(offsetCharacter:String)
|
|
{
|
|
var daFile:Array<String> = CoolUtil.coolTextFile(Paths.file("images/characters/" + offsetCharacter + "Offsets.txt"));
|
|
|
|
for (i in daFile)
|
|
{
|
|
var splitWords:Array<String> = i.split(" ");
|
|
addOffset(splitWords[0], Std.parseInt(splitWords[1]), Std.parseInt(splitWords[2]));
|
|
}
|
|
}
|
|
|
|
override function update(elapsed:Float)
|
|
{
|
|
if (!curCharacter.startsWith('bf'))
|
|
{
|
|
if (animation.curAnim.name.startsWith('sing'))
|
|
{
|
|
holdTimer += elapsed;
|
|
}
|
|
|
|
var dadVar:Float = 4;
|
|
|
|
if (curCharacter == 'dad')
|
|
dadVar = 6.1;
|
|
if (holdTimer >= Conductor.stepCrochet * dadVar * 0.001)
|
|
{
|
|
dance();
|
|
holdTimer = 0;
|
|
}
|
|
}
|
|
|
|
if (curCharacter.endsWith('-car'))
|
|
{
|
|
// looping hair anims after idle finished
|
|
if (!animation.curAnim.name.startsWith('sing') && animation.curAnim.finished)
|
|
playAnim('idleHair');
|
|
}
|
|
|
|
switch (curCharacter)
|
|
{
|
|
case 'gf':
|
|
if (animation.curAnim.name == 'hairFall' && animation.curAnim.finished)
|
|
playAnim('danceRight');
|
|
}
|
|
|
|
super.update(elapsed);
|
|
}
|
|
|
|
private var danced:Bool = false;
|
|
|
|
/**
|
|
* FOR GF DANCING SHIT
|
|
*/
|
|
public function dance()
|
|
{
|
|
if (!debugMode)
|
|
{
|
|
switch (curCharacter)
|
|
{
|
|
case 'gf' | 'gf-christmas' | 'gf-car' | 'gf-pixel':
|
|
if (!animation.curAnim.name.startsWith('hair'))
|
|
{
|
|
danced = !danced;
|
|
|
|
if (danced)
|
|
playAnim('danceRight');
|
|
else
|
|
playAnim('danceLeft');
|
|
}
|
|
|
|
case 'pico-speaker':
|
|
playAnim('shoot' + FlxG.random.int(1, 4), true);
|
|
|
|
case 'spooky':
|
|
danced = !danced;
|
|
|
|
if (danced)
|
|
playAnim('danceRight');
|
|
else
|
|
playAnim('danceLeft');
|
|
default:
|
|
playAnim('idle');
|
|
}
|
|
}
|
|
}
|
|
|
|
public function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void
|
|
{
|
|
animation.play(AnimName, Force, Reversed, Frame);
|
|
|
|
var daOffset = animOffsets.get(AnimName);
|
|
if (animOffsets.exists(AnimName))
|
|
{
|
|
offset.set(daOffset[0], daOffset[1]);
|
|
}
|
|
else
|
|
offset.set(0, 0);
|
|
|
|
if (curCharacter == 'gf')
|
|
{
|
|
if (AnimName == 'singLEFT')
|
|
{
|
|
danced = true;
|
|
}
|
|
else if (AnimName == 'singRIGHT')
|
|
{
|
|
danced = false;
|
|
}
|
|
|
|
if (AnimName == 'singUP' || AnimName == 'singDOWN')
|
|
{
|
|
danced = !danced;
|
|
}
|
|
}
|
|
}
|
|
|
|
public function addOffset(name:String, x:Float = 0, y:Float = 0)
|
|
{
|
|
animOffsets[name] = [x, y];
|
|
}
|
|
}
|