Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package;
- import flixel.FlxSprite;
- import flixel.graphics.frames.FlxAtlasFrames;
- class BGSprite extends FlxSprite
- {
- private var idleAnim:String;
- //I hate StageData when library didn't select it or anything :/
- public function new(image:String, ?library:String, x:Float = 0, y:Float = 0, ?scrollX:Float = 1, ?scrollY:Float = 1, ?animArray:Array<String> = null, ?loop:Bool = false) {
- super(x, y);
- if (animArray != null) {
- frames = Paths.getSparrowAtlas(image, library);
- for (i in 0...animArray.length) {
- var anim:String = animArray[i];
- animation.addByPrefix(anim, anim, 24, loop);
- if(idleAnim == null) {
- idleAnim = anim;
- animation.play(anim);
- }
- }
- } else {
- if(image != null) {
- loadGraphic(Paths.image(image, library));
- }
- active = false;
- }
- scrollFactor.set(scrollX, scrollY);
- antialiasing = ClientPrefs.globalAntialiasing;
- }
- public function dance(?forceplay:Bool = false) {
- if(idleAnim != null) {
- animation.play(idleAnim, forceplay);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement