1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-09 16:24:42 +00:00
Funkin/source/Character.hx

716 lines
24 KiB
Haxe
Raw Normal View History

2020-10-04 22:27:49 +00:00
package;
2021-02-25 01:22:37 +00:00
import flixel.FlxG;
2020-10-04 22:27:49 +00:00
import flixel.FlxSprite;
2020-12-09 22:36:31 +00:00
import flixel.animation.FlxBaseAnimation;
2020-10-19 00:59:53 +00:00
import flixel.graphics.frames.FlxAtlasFrames;
2021-03-14 01:53:57 +00:00
import haxe.io.Path;
2020-10-04 22:27:49 +00:00
2020-11-11 10:00:13 +00:00
using StringTools;
2020-10-04 22:27:49 +00:00
class Character extends FlxSprite
{
public var animOffsets:Map<String, Array<Dynamic>>;
public var debugMode:Bool = false;
2020-10-19 00:59:53 +00:00
public var isPlayer:Bool = false;
public var curCharacter:String = 'bf';
2020-11-11 10:00:13 +00:00
public var holdTimer:Float = 0;
2020-10-19 00:59:53 +00:00
public function new(x:Float, y:Float, ?character:String = "bf", ?isPlayer:Bool = false)
2020-10-04 22:27:49 +00:00
{
super(x, y);
2020-10-19 00:59:53 +00:00
2021-02-25 01:22:37 +00:00
animOffsets = new Map<String, Array<Dynamic>>();
2020-10-19 00:59:53 +00:00
curCharacter = character;
this.isPlayer = isPlayer;
var tex:FlxAtlasFrames;
antialiasing = true;
switch (curCharacter)
{
case 'gf':
// GIRLFRIEND CODE
2021-03-14 04:02:14 +00:00
tex = Paths.getSparrowAtlas('characters/GF_assets');
2020-10-19 00:59:53 +00:00
frames = tex;
animation.addByPrefix('cheer', 'GF Cheer', 24, false);
animation.addByPrefix('singLEFT', 'GF left note', 24, false);
animation.addByPrefix('singRIGHT', 'GF Right Note', 24, false);
animation.addByPrefix('singUP', 'GF Up Note', 24, false);
animation.addByPrefix('singDOWN', 'GF Down Note', 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);
2020-12-11 11:45:00 +00:00
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);
2020-11-02 06:46:37 +00:00
animation.addByPrefix('scared', 'GF FEAR', 24);
2021-03-14 04:02:14 +00:00
loadOffsetFile(curCharacter);
2020-11-02 06:46:37 +00:00
2020-10-19 00:59:53 +00:00
playAnim('danceRight');
2020-11-11 10:00:13 +00:00
2021-01-20 02:09:47 +00:00
case 'gf-christmas':
2021-02-08 21:34:48 +00:00
tex = Paths.getSparrowAtlas('christmas/gfChristmas');
2021-01-20 02:09:47 +00:00
frames = tex;
animation.addByPrefix('cheer', 'GF Cheer', 24, false);
animation.addByPrefix('singLEFT', 'GF left note', 24, false);
animation.addByPrefix('singRIGHT', 'GF Right Note', 24, false);
animation.addByPrefix('singUP', 'GF Up Note', 24, false);
animation.addByPrefix('singDOWN', 'GF Down Note', 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);
addOffset('cheer');
2021-03-09 11:29:00 +00:00
addOffset('sad', -2, -21);
2021-01-20 02:09:47 +00:00
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');
2021-03-17 09:20:25 +00:00
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');
2021-03-17 09:29:04 +00:00
flipX = true;
2021-01-15 04:33:12 +00:00
case 'gf-car':
2021-02-08 21:34:48 +00:00
tex = Paths.getSparrowAtlas('gfCar');
2021-01-15 04:33:12 +00:00
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);
addOffset('danceLeft', 0);
addOffset('danceRight', 0);
playAnim('danceRight');
2021-01-25 09:18:44 +00:00
case 'gf-pixel':
2021-02-08 21:34:48 +00:00
tex = Paths.getSparrowAtlas('weeb/gfPixel');
2021-01-25 09:18:44 +00:00
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;
2020-10-19 00:59:53 +00:00
case 'dad':
// DAD ANIMATION LOADING CODE
2021-02-08 21:34:48 +00:00
tex = Paths.getSparrowAtlas('DADDY_DEAREST');
2020-10-19 00:59:53 +00:00
frames = tex;
animation.addByPrefix('idle', 'Dad idle dance', 24);
animation.addByPrefix('singUP', 'Dad Sing Note UP', 24);
animation.addByPrefix('singRIGHT', 'Dad Sing Note RIGHT', 24);
animation.addByPrefix('singDOWN', 'Dad Sing Note DOWN', 24);
animation.addByPrefix('singLEFT', 'Dad Sing Note LEFT', 24);
addOffset('idle');
addOffset("singUP", -6, 50);
addOffset("singRIGHT", 0, 27);
addOffset("singLEFT", -10, 10);
addOffset("singDOWN", 0, -30);
2021-01-15 04:33:12 +00:00
playAnim('idle');
2020-10-23 23:12:38 +00:00
case 'spooky':
2021-02-08 21:34:48 +00:00
tex = Paths.getSparrowAtlas('spooky_kids_assets');
2020-10-23 23:12:38 +00:00
frames = tex;
animation.addByPrefix('singUP', 'spooky UP NOTE', 24, false);
animation.addByPrefix('singDOWN', 'spooky DOWN note', 24, false);
animation.addByPrefix('singLEFT', 'note sing left', 24, false);
animation.addByPrefix('singRIGHT', 'spooky sing right', 24, false);
2020-10-30 23:47:19 +00:00
animation.addByIndices('danceLeft', 'spooky dance idle', [0, 2, 6], "", 12, false);
2020-10-23 23:12:38 +00:00
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');
2020-12-23 01:55:03 +00:00
case 'mom':
2021-02-08 21:34:48 +00:00
tex = Paths.getSparrowAtlas('Mom_Assets');
2020-12-23 01:55:03 +00:00
frames = tex;
animation.addByPrefix('idle', "Mom Idle", 24, false);
animation.addByPrefix('singUP', "Mom Up Pose", 24, false);
animation.addByPrefix('singDOWN', "MOM DOWN POSE", 24, false);
animation.addByPrefix('singLEFT', 'Mom Left Pose', 24, false);
// ANIMATION IS CALLED MOM LEFT POSE BUT ITS FOR THE RIGHT
// CUZ DAVE IS DUMB!
animation.addByPrefix('singRIGHT', 'Mom Pose Left', 24, false);
2021-01-15 04:33:12 +00:00
addOffset('idle');
addOffset("singUP", 14, 71);
addOffset("singRIGHT", 10, -60);
addOffset("singLEFT", 250, -23);
addOffset("singDOWN", 20, -160);
2020-12-23 01:55:03 +00:00
playAnim('idle');
2021-01-15 04:33:12 +00:00
case 'mom-car':
2021-02-08 21:34:48 +00:00
tex = Paths.getSparrowAtlas('momCar');
2021-01-15 04:33:12 +00:00
frames = tex;
animation.addByPrefix('idle', "Mom Idle", 24, false);
animation.addByPrefix('singUP', "Mom Up Pose", 24, false);
animation.addByPrefix('singDOWN', "MOM DOWN POSE", 24, false);
animation.addByPrefix('singLEFT', 'Mom Left Pose', 24, false);
// ANIMATION IS CALLED MOM LEFT POSE BUT ITS FOR THE RIGHT
// CUZ DAVE IS DUMB!
animation.addByPrefix('singRIGHT', 'Mom Pose Left', 24, false);
2020-12-23 01:55:03 +00:00
addOffset('idle');
addOffset("singUP", 14, 71);
addOffset("singRIGHT", 10, -60);
addOffset("singLEFT", 250, -23);
addOffset("singDOWN", 20, -160);
2021-01-15 04:33:12 +00:00
playAnim('idle');
2020-10-30 23:47:19 +00:00
case 'monster':
2021-02-08 21:34:48 +00:00
tex = Paths.getSparrowAtlas('Monster_Assets');
2020-10-30 23:47:19 +00:00
frames = tex;
2021-01-20 06:38:39 +00:00
animation.addByPrefix('idle', 'monster idle', 24, false);
2020-10-30 23:47:19 +00:00
animation.addByPrefix('singUP', 'monster up note', 24, false);
animation.addByPrefix('singDOWN', 'monster down', 24, false);
animation.addByPrefix('singLEFT', 'Monster left note', 24, false);
animation.addByPrefix('singRIGHT', 'Monster Right note', 24, false);
addOffset('idle');
2021-03-02 09:30:25 +00:00
addOffset("singUP", -20, 94);
addOffset("singRIGHT", -51, 30);
addOffset("singLEFT", -30, 20);
addOffset("singDOWN", -50, -80);
2020-10-30 23:47:19 +00:00
playAnim('idle');
2021-01-20 06:38:39 +00:00
case 'monster-christmas':
2021-02-08 21:34:48 +00:00
tex = Paths.getSparrowAtlas('christmas/monsterChristmas');
2021-01-20 06:38:39 +00:00
frames = tex;
animation.addByPrefix('idle', 'monster idle', 24, false);
animation.addByPrefix('singUP', 'monster up note', 24, false);
animation.addByPrefix('singDOWN', 'monster down', 24, false);
animation.addByPrefix('singLEFT', 'Monster left note', 24, false);
animation.addByPrefix('singRIGHT', 'Monster Right note', 24, false);
addOffset('idle');
addOffset("singUP", -20, 50);
addOffset("singRIGHT", -51);
addOffset("singLEFT", -30);
addOffset("singDOWN", -40, -94);
playAnim('idle');
2020-12-09 22:36:31 +00:00
case 'pico':
2021-02-08 21:34:48 +00:00
tex = Paths.getSparrowAtlas('Pico_FNF_assetss');
2020-11-10 17:52:49 +00:00
frames = tex;
2020-12-09 22:36:31 +00:00
animation.addByPrefix('idle', "Pico Idle Dance", 24);
animation.addByPrefix('singUP', 'pico Up note0', 24, false);
animation.addByPrefix('singDOWN', 'Pico Down Note0', 24, false);
if (isPlayer)
{
animation.addByPrefix('singLEFT', 'Pico NOTE LEFT0', 24, false);
animation.addByPrefix('singRIGHT', 'Pico Note Right0', 24, false);
animation.addByPrefix('singRIGHTmiss', 'Pico Note Right Miss', 24, false);
animation.addByPrefix('singLEFTmiss', 'Pico NOTE LEFT miss', 24, false);
}
else
{
// Need to be flipped! REDO THIS LATER!
animation.addByPrefix('singLEFT', 'Pico Note Right0', 24, false);
animation.addByPrefix('singRIGHT', 'Pico NOTE LEFT0', 24, false);
animation.addByPrefix('singRIGHTmiss', 'Pico NOTE LEFT miss', 24, false);
animation.addByPrefix('singLEFTmiss', 'Pico Note Right Miss', 24, false);
}
animation.addByPrefix('singUPmiss', 'pico Up note miss', 24);
animation.addByPrefix('singDOWNmiss', 'Pico Down Note MISS', 24);
addOffset('idle');
addOffset("singUP", -29, 27);
addOffset("singRIGHT", -68, -7);
addOffset("singLEFT", 65, 9);
2020-12-09 22:46:47 +00:00
addOffset("singDOWN", 200, -70);
2020-12-09 22:36:31 +00:00
addOffset("singUPmiss", -19, 67);
addOffset("singRIGHTmiss", -60, 41);
addOffset("singLEFTmiss", 62, 64);
addOffset("singDOWNmiss", 210, -28);
2021-01-15 04:33:12 +00:00
playAnim('idle');
2021-01-14 03:38:31 +00:00
flipX = true;
2020-12-09 22:36:31 +00:00
2021-03-14 01:53:57 +00:00
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');
2020-12-09 22:36:31 +00:00
case 'bf':
2021-03-14 04:02:14 +00:00
var tex = Paths.getSparrowAtlas('characters/BOYFRIEND');
2020-12-09 22:36:31 +00:00
frames = tex;
animation.addByPrefix('idle', 'BF idle dance', 24, false);
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
animation.addByPrefix('singLEFT', 'BF NOTE LEFT0', 24, false);
animation.addByPrefix('singRIGHT', 'BF NOTE RIGHT0', 24, false);
animation.addByPrefix('singDOWN', 'BF NOTE DOWN0', 24, false);
animation.addByPrefix('singUPmiss', 'BF NOTE UP MISS', 24, false);
animation.addByPrefix('singLEFTmiss', 'BF NOTE LEFT MISS', 24, false);
animation.addByPrefix('singRIGHTmiss', 'BF NOTE RIGHT MISS', 24, false);
animation.addByPrefix('singDOWNmiss', 'BF NOTE DOWN MISS', 24, false);
animation.addByPrefix('hey', 'BF HEY', 24, false);
animation.addByPrefix('firstDeath', "BF dies", 24, false);
animation.addByPrefix('deathLoop', "BF Dead Loop", 24, true);
animation.addByPrefix('deathConfirm', "BF Dead confirm", 24, false);
animation.addByPrefix('scared', 'BF idle shaking', 24);
2021-03-14 04:02:14 +00:00
loadOffsetFile(curCharacter);
2021-01-14 03:38:31 +00:00
2021-02-02 09:13:28 +00:00
playAnim('idle');
2021-01-20 02:44:09 +00:00
flipX = true;
2021-03-14 04:02:14 +00:00
loadOffsetFile(curCharacter);
2021-01-20 02:44:09 +00:00
case 'bf-christmas':
2021-02-08 21:34:48 +00:00
var tex = Paths.getSparrowAtlas('christmas/bfChristmas');
2021-01-20 02:44:09 +00:00
frames = tex;
animation.addByPrefix('idle', 'BF idle dance', 24, false);
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
animation.addByPrefix('singLEFT', 'BF NOTE LEFT0', 24, false);
animation.addByPrefix('singRIGHT', 'BF NOTE RIGHT0', 24, false);
animation.addByPrefix('singDOWN', 'BF NOTE DOWN0', 24, false);
animation.addByPrefix('singUPmiss', 'BF NOTE UP MISS', 24, false);
animation.addByPrefix('singLEFTmiss', 'BF NOTE LEFT MISS', 24, false);
animation.addByPrefix('singRIGHTmiss', 'BF NOTE RIGHT MISS', 24, false);
animation.addByPrefix('singDOWNmiss', 'BF NOTE DOWN MISS', 24, false);
animation.addByPrefix('hey', 'BF HEY', 24, false);
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);
2021-02-02 09:13:28 +00:00
playAnim('idle');
2021-01-15 04:33:12 +00:00
flipX = true;
case 'bf-car':
2021-02-08 21:34:48 +00:00
var tex = Paths.getSparrowAtlas('bfCar');
2021-01-15 04:33:12 +00:00
frames = tex;
animation.addByPrefix('idle', 'BF idle dance', 24, false);
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
animation.addByPrefix('singLEFT', 'BF NOTE LEFT0', 24, false);
animation.addByPrefix('singRIGHT', 'BF NOTE RIGHT0', 24, false);
animation.addByPrefix('singDOWN', 'BF NOTE DOWN0', 24, false);
animation.addByPrefix('singUPmiss', 'BF NOTE UP MISS', 24, false);
animation.addByPrefix('singLEFTmiss', 'BF NOTE LEFT MISS', 24, false);
animation.addByPrefix('singRIGHTmiss', 'BF NOTE RIGHT MISS', 24, false);
animation.addByPrefix('singDOWNmiss', 'BF NOTE DOWN MISS', 24, false);
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);
2021-02-02 09:13:28 +00:00
playAnim('idle');
2021-01-15 04:33:12 +00:00
2021-01-25 03:42:51 +00:00
flipX = true;
case 'bf-pixel':
2021-02-08 21:34:48 +00:00
frames = Paths.getSparrowAtlas('weeb/bfPixel');
2021-01-25 03:42:51 +00:00
animation.addByPrefix('idle', 'BF IDLE', 24, false);
animation.addByPrefix('singUP', 'BF UP NOTE', 24, false);
animation.addByPrefix('singLEFT', 'BF LEFT NOTE', 24, false);
animation.addByPrefix('singRIGHT', 'BF RIGHT NOTE', 24, false);
animation.addByPrefix('singDOWN', 'BF DOWN NOTE', 24, false);
animation.addByPrefix('singUPmiss', 'BF UP MISS', 24, false);
animation.addByPrefix('singLEFTmiss', 'BF LEFT MISS', 24, false);
animation.addByPrefix('singRIGHTmiss', 'BF RIGHT MISS', 24, false);
animation.addByPrefix('singDOWNmiss', 'BF DOWN MISS', 24, false);
addOffset('idle');
addOffset("singUP");
addOffset("singRIGHT");
addOffset("singLEFT");
addOffset("singDOWN");
addOffset("singUPmiss");
addOffset("singRIGHTmiss");
addOffset("singLEFTmiss");
addOffset("singDOWNmiss");
setGraphicSize(Std.int(width * 6));
updateHitbox();
2021-02-02 09:13:28 +00:00
playAnim('idle');
2021-01-25 03:42:51 +00:00
width -= 100;
height -= 100;
antialiasing = false;
2021-01-14 03:38:31 +00:00
flipX = true;
2021-01-30 12:16:51 +00:00
case 'bf-pixel-dead':
2021-02-08 21:34:48 +00:00
frames = Paths.getSparrowAtlas('weeb/bfPixelsDEAD');
2021-01-30 12:16:51 +00:00
animation.addByPrefix('singUP', "BF Dies pixel", 24, false);
animation.addByPrefix('firstDeath', "BF Dies pixel", 24, false);
animation.addByPrefix('deathLoop', "Retry Loop", 24, true);
animation.addByPrefix('deathConfirm', "RETRY CONFIRM", 24, false);
animation.play('firstDeath');
2021-01-31 14:17:56 +00:00
addOffset('firstDeath');
addOffset('deathLoop', -30, -12);
addOffset('deathConfirm', -30, -12);
2021-01-31 14:17:56 +00:00
playAnim('firstDeath');
2021-01-30 12:16:51 +00:00
// pixel bullshit
setGraphicSize(Std.int(width * 6));
updateHitbox();
antialiasing = false;
flipX = true;
2021-01-25 11:07:45 +00:00
case 'senpai':
2021-02-08 21:34:48 +00:00
frames = Paths.getSparrowAtlas('weeb/senpai');
2021-01-25 11:07:45 +00:00
animation.addByPrefix('idle', 'Senpai Idle', 24, false);
animation.addByPrefix('singUP', 'SENPAI UP NOTE', 24, false);
animation.addByPrefix('singLEFT', 'SENPAI LEFT NOTE', 24, false);
animation.addByPrefix('singRIGHT', 'SENPAI RIGHT NOTE', 24, false);
animation.addByPrefix('singDOWN', 'SENPAI DOWN NOTE', 24, false);
addOffset('idle');
addOffset("singUP", 5, 37);
addOffset("singRIGHT");
addOffset("singLEFT", 40);
addOffset("singDOWN", 14);
2021-02-02 08:24:34 +00:00
2021-02-02 09:13:28 +00:00
playAnim('idle');
2021-02-02 08:24:34 +00:00
setGraphicSize(Std.int(width * 6));
updateHitbox();
antialiasing = false;
case 'senpai-angry':
2021-02-08 21:34:48 +00:00
frames = Paths.getSparrowAtlas('weeb/senpai');
2021-02-02 08:24:34 +00:00
animation.addByPrefix('idle', 'Angry Senpai Idle', 24, false);
animation.addByPrefix('singUP', 'Angry Senpai UP NOTE', 24, false);
animation.addByPrefix('singLEFT', 'Angry Senpai LEFT NOTE', 24, false);
animation.addByPrefix('singRIGHT', 'Angry Senpai RIGHT NOTE', 24, false);
animation.addByPrefix('singDOWN', 'Angry Senpai DOWN NOTE', 24, false);
addOffset('idle');
addOffset("singUP", 5, 37);
addOffset("singRIGHT");
addOffset("singLEFT", 40);
addOffset("singDOWN", 14);
2021-02-02 09:13:28 +00:00
playAnim('idle');
2021-01-25 11:07:45 +00:00
setGraphicSize(Std.int(width * 6));
updateHitbox();
antialiasing = false;
2021-02-02 05:48:22 +00:00
case 'spirit':
2021-02-08 21:34:48 +00:00
frames = Paths.getPackerAtlas('weeb/spirit');
2021-02-02 05:48:22 +00:00
animation.addByPrefix('idle', "idle spirit_", 24, false);
animation.addByPrefix('singUP', "up_", 24, false);
animation.addByPrefix('singRIGHT', "right_", 24, false);
animation.addByPrefix('singLEFT', "left_", 24, false);
animation.addByPrefix('singDOWN', "spirit down_", 24, false);
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;
2021-01-16 20:14:56 +00:00
case 'parents-christmas':
2021-02-08 21:34:48 +00:00
frames = Paths.getSparrowAtlas('christmas/mom_dad_christmas_assets');
2021-01-16 20:14:56 +00:00
animation.addByPrefix('idle', 'Parent Christmas Idle', 24, false);
animation.addByPrefix('singUP', 'Parent Up Note Dad', 24, false);
animation.addByPrefix('singDOWN', 'Parent Down Note Dad', 24, false);
animation.addByPrefix('singLEFT', 'Parent Left Note Dad', 24, false);
animation.addByPrefix('singRIGHT', 'Parent Right Note Dad', 24, false);
animation.addByPrefix('singUP-alt', 'Parent Up Note Mom', 24, false);
animation.addByPrefix('singDOWN-alt', 'Parent Down Note Mom', 24, false);
animation.addByPrefix('singLEFT-alt', 'Parent Left Note Mom', 24, false);
animation.addByPrefix('singRIGHT-alt', 'Parent Right Note Mom', 24, false);
2021-01-16 22:21:06 +00:00
addOffset('idle');
2021-01-17 09:16:02 +00:00
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);
2021-02-02 09:13:28 +00:00
playAnim('idle');
2021-03-04 08:00:48 +00:00
case 'tankman':
frames = Paths.getSparrowAtlas('characters/tankmanCaptain');
2021-03-04 19:30:35 +00:00
2021-03-04 08:00:48 +00:00
animation.addByPrefix('idle', "Tankman Idle Dance", 24, false);
2021-03-04 19:30:35 +00:00
if (isPlayer)
{
animation.addByPrefix('singLEFT', 'Tankman Note Left0', 24, false);
animation.addByPrefix('singRIGHT', 'Tankman Right Note0', 24, false);
animation.addByPrefix('singLEFTmiss', 'Tankman Note Left MISS', 24, false);
animation.addByPrefix('singRIGHTmiss', 'Tankman Right Note MISS', 24, false);
}
else
{
// Need to be flipped! REDO THIS LATER
animation.addByPrefix('singLEFT', 'Tankman Right Note0', 24, false);
animation.addByPrefix('singRIGHT', 'Tankman Note Left0', 24, false);
animation.addByPrefix('singLEFTmiss', 'Tankman Right Note MISS', 24, false);
animation.addByPrefix('singRIGHTmiss', 'Tankman Note Left MISS', 24, false);
}
2021-03-04 08:00:48 +00:00
animation.addByPrefix('singUP', 'Tankman UP note0', 24, false);
animation.addByPrefix('singDOWN', 'Tankman DOWN note0', 24, false);
animation.addByPrefix('singUPmiss', 'Tankman UP note MISS', 24, false);
animation.addByPrefix('singDOWNmiss', 'Tankman DOWN note MISS', 24, false);
2021-03-14 01:53:57 +00:00
loadOffsetFile(curCharacter);
2021-03-04 08:00:48 +00:00
playAnim('idle');
flipX = true;
2021-01-14 03:38:31 +00:00
}
2021-02-02 09:13:28 +00:00
dance();
2021-01-14 03:38:31 +00:00
if (isPlayer)
{
flipX = !flipX;
2021-01-16 20:20:57 +00:00
// Doesn't flip for BF, since his are already in the right place???
2021-01-25 03:42:51 +00:00
if (!curCharacter.startsWith('bf'))
2021-01-14 03:38:31 +00:00
{
2021-01-16 20:20:57 +00:00
// 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;
}
2021-01-14 03:38:31 +00:00
}
2020-10-19 00:59:53 +00:00
}
}
2021-03-14 01:53:57 +00:00
function quickAnimAdd(name:String, prefix:String)
{
animation.addByPrefix(name, prefix, 24, false);
}
2021-03-04 08:00:48 +00:00
private function loadOffsetFile(offsetCharacter:String)
{
2021-03-14 01:53:57 +00:00
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]));
}
2021-03-04 08:00:48 +00:00
}
2020-11-11 10:00:13 +00:00
override function update(elapsed:Float)
{
2021-01-22 06:50:12 +00:00
if (!curCharacter.startsWith('bf'))
2020-11-11 10:00:13 +00:00
{
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;
}
}
2020-12-11 12:55:39 +00:00
switch (curCharacter)
{
case 'gf':
if (animation.curAnim.name == 'hairFall' && animation.curAnim.finished)
playAnim('danceRight');
}
2020-11-11 10:00:13 +00:00
super.update(elapsed);
}
2020-10-19 00:59:53 +00:00
private var danced:Bool = false;
/**
* FOR GF DANCING SHIT
*/
public function dance()
{
2021-01-17 09:16:02 +00:00
if (!debugMode)
2020-10-19 00:59:53 +00:00
{
2021-01-17 09:16:02 +00:00
switch (curCharacter)
{
case 'gf':
if (!animation.curAnim.name.startsWith('hair'))
{
danced = !danced;
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
}
2021-01-20 02:09:47 +00:00
case 'gf-christmas':
if (!animation.curAnim.name.startsWith('hair'))
{
danced = !danced;
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
}
2021-01-17 09:16:02 +00:00
case 'gf-car':
if (!animation.curAnim.name.startsWith('hair'))
2021-01-25 09:18:44 +00:00
{
danced = !danced;
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
}
case 'gf-pixel':
if (!animation.curAnim.name.startsWith('hair'))
2021-01-17 09:16:02 +00:00
{
danced = !danced;
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
}
2021-03-14 01:53:57 +00:00
case 'pico-speaker':
playAnim('shoot' + FlxG.random.int(1, 4), true);
2021-01-17 09:16:02 +00:00
case 'spooky':
2021-01-15 04:33:12 +00:00
danced = !danced;
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
2021-01-25 03:42:51 +00:00
default:
2021-01-17 09:16:02 +00:00
playAnim('idle');
}
2020-10-19 00:59:53 +00:00
}
2020-10-04 22:27:49 +00:00
}
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))
2020-10-04 22:27:49 +00:00
{
2021-01-16 20:20:57 +00:00
offset.set(daOffset[0], daOffset[1]);
2020-10-04 22:27:49 +00:00
}
2021-02-02 09:13:28 +00:00
else
offset.set(0, 0);
2020-10-30 23:47:19 +00:00
if (curCharacter == 'gf')
{
if (AnimName == 'singLEFT')
{
danced = true;
}
else if (AnimName == 'singRIGHT')
{
danced = false;
}
if (AnimName == 'singUP' || AnimName == 'singDOWN')
{
danced = !danced;
}
}
2020-10-04 22:27:49 +00:00
}
public function addOffset(name:String, x:Float = 0, y:Float = 0)
{
animOffsets[name] = [x, y];
}
}