1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-17 20:32:53 +00:00
Funkin/source/Boyfriend.hx

78 lines
2.2 KiB
Haxe
Raw Normal View History

2020-10-04 18:50:12 +00:00
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
2020-11-11 03:09:48 +00:00
import flixel.util.FlxTimer;
2020-10-04 18:50:12 +00:00
2020-10-05 03:29:35 +00:00
using StringTools;
2020-10-04 22:27:49 +00:00
class Boyfriend extends Character
2020-10-04 18:50:12 +00:00
{
2020-10-05 03:29:35 +00:00
public var stunned:Bool = false;
2020-10-04 18:50:12 +00:00
public function new(x:Float, y:Float)
{
super(x, y);
var tex = FlxAtlasFrames.fromSparrow(AssetPaths.BOYFRIEND__png, AssetPaths.BOYFRIEND__xml);
frames = tex;
animation.addByPrefix('idle', 'BF idle dance', 24, false);
2020-10-05 03:29:35 +00:00
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);
2020-10-04 18:50:12 +00:00
animation.addByPrefix('hey', 'BF HEY', 24, false);
2020-10-27 10:35:23 +00:00
animation.addByPrefix('firstDeath', "BF dies", 24, false);
animation.addByPrefix('deathLoop', "BF Dead Loop", 24, true);
animation.addByPrefix('deathConfirm', "BF Dead confirm", 24, false);
2020-11-01 23:20:13 +00:00
animation.addByPrefix('scared', 'BF idle shaking', 24);
2020-10-04 21:44:52 +00:00
playAnim('idle');
2020-10-05 02:31:38 +00:00
antialiasing = true;
2020-10-05 00:53:49 +00:00
addOffset('idle', -5);
addOffset("singUP", -29, 27);
2020-10-04 21:44:52 +00:00
addOffset("singRIGHT", -38, -7);
addOffset("singLEFT", 12, -6);
2020-10-05 00:53:49 +00:00
addOffset("singDOWN", -10, -50);
2020-10-05 03:29:35 +00:00
addOffset("singUPmiss", -29, 27);
addOffset("singRIGHTmiss", -30, 21);
addOffset("singLEFTmiss", 12, 24);
addOffset("singDOWNmiss", -11, -19);
2020-10-05 00:53:49 +00:00
addOffset("hey", 7, 4);
2020-10-27 10:35:23 +00:00
addOffset('firstDeath', 37, 11);
addOffset('deathLoop', 37, 5);
addOffset('deathConfirm', 37, 69);
2020-11-01 23:20:13 +00:00
addOffset('scared', -4);
2020-10-04 21:44:52 +00:00
}
2020-10-05 03:29:35 +00:00
override function update(elapsed:Float)
{
2020-11-11 03:09:48 +00:00
if (animation.curAnim.name.startsWith('sing'))
{
holdTimer += elapsed;
}
else
holdTimer = 0;
2020-10-05 03:29:35 +00:00
if (animation.curAnim.name.endsWith('miss') && animation.curAnim.finished && !debugMode)
{
playAnim('idle', true, false, 10);
}
2020-10-27 10:35:23 +00:00
if (animation.curAnim.name == 'firstDeath' && animation.curAnim.finished)
{
playAnim('deathLoop');
}
2020-10-05 03:29:35 +00:00
super.update(elapsed);
}
2020-10-04 18:50:12 +00:00
}