1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-27 01:03:35 +00:00
Funkin/source/BGSprite.hx

44 lines
846 B
Haxe
Raw Normal View History

2021-03-07 20:34:21 +00:00
package;
import flixel.FlxSprite;
class BGSprite extends FlxSprite
{
/**
Cool lil utility thing just so that it can easy do antialiasing and scrollfactor bullshit
*/
2021-03-08 23:38:58 +00:00
public var idleAnim:String;
2021-03-31 19:41:45 +00:00
public function new(image:String, x:Float = 0, y:Float = 0, parX:Float = 1, parY:Float = 1, ?daAnimations:Array<String>, ?loopingAnim:Bool = false)
2021-03-07 20:34:21 +00:00
{
super(x, y);
2021-03-08 23:38:58 +00:00
if (daAnimations != null)
{
frames = Paths.getSparrowAtlas(image);
for (anims in daAnimations)
{
2021-03-31 19:41:45 +00:00
animation.addByPrefix(anims, anims, 24, loopingAnim);
2021-03-08 23:38:58 +00:00
animation.play(anims);
if (idleAnim == null)
idleAnim = anims;
}
}
else
{
loadGraphic(Paths.image(image));
active = false;
}
2021-03-07 20:34:21 +00:00
scrollFactor.set(parX, parY);
antialiasing = true;
2021-03-08 23:38:58 +00:00
}
public function dance():Void
{
if (idleAnim != null)
animation.play(idleAnim);
2021-03-07 20:34:21 +00:00
}
}