mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-30 16:56:47 +00:00
anim shit for stages
This commit is contained in:
parent
7ef82bd1d3
commit
2747de79cb
|
@ -9,32 +9,53 @@ class BGSprite extends FlxSprite
|
|||
*/
|
||||
public var idleAnim:String;
|
||||
|
||||
public function new(image:String, x:Float = 0, y:Float = 0, parX:Float = 1, parY:Float = 1, ?daAnimations:Array<String>, ?loopingAnim:Bool = false)
|
||||
/**
|
||||
* NOTE: loadOldWay param is just for current backward compatibility! Will be moved later!
|
||||
*/
|
||||
public function new(image:String, x:Float = 0, y:Float = 0, parX:Float = 1, parY:Float = 1, ?daAnimations:Array<String>, ?loopingAnim:Bool = false,
|
||||
?loadOldWay:Bool = true)
|
||||
{
|
||||
super(x, y);
|
||||
|
||||
if (daAnimations != null)
|
||||
if (loadOldWay)
|
||||
{
|
||||
frames = Paths.getSparrowAtlas(image);
|
||||
for (anims in daAnimations)
|
||||
if (daAnimations != null)
|
||||
{
|
||||
animation.addByPrefix(anims, anims, 24, loopingAnim);
|
||||
animation.play(anims);
|
||||
|
||||
if (idleAnim == null)
|
||||
idleAnim = anims;
|
||||
setupSparrow(image, daAnimations, loopingAnim);
|
||||
}
|
||||
else
|
||||
{
|
||||
justLoadImage(image);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
loadGraphic(Paths.image(image));
|
||||
active = false;
|
||||
}
|
||||
|
||||
scrollFactor.set(parX, parY);
|
||||
antialiasing = true;
|
||||
}
|
||||
|
||||
public function setupSparrow(image:String, daAnimations:Array<String>, ?loopingAnim:Bool = false)
|
||||
{
|
||||
frames = Paths.getSparrowAtlas(image);
|
||||
for (anims in daAnimations)
|
||||
{
|
||||
var daLoop:Bool = loopingAnim;
|
||||
if (loopingAnim == null)
|
||||
daLoop = false;
|
||||
|
||||
animation.addByPrefix(anims, anims, 24, daLoop);
|
||||
animation.play(anims);
|
||||
|
||||
if (idleAnim == null)
|
||||
idleAnim = anims;
|
||||
}
|
||||
}
|
||||
|
||||
public function justLoadImage(image:String)
|
||||
{
|
||||
loadGraphic(Paths.image(image));
|
||||
active = false;
|
||||
}
|
||||
|
||||
public function dance():Void
|
||||
{
|
||||
if (idleAnim != null)
|
||||
|
|
|
@ -526,13 +526,6 @@ class PlayState extends MusicBeatState
|
|||
tankSky.velocity.x = FlxG.random.float(5, 15);
|
||||
add(tankSky);
|
||||
|
||||
// need to implement animated effects, prob not too hard?
|
||||
var smokeLeft:BGSprite = new BGSprite('smokeLeft', -200, -100, 0.4, 0.4, ['SmokeBlurLeft'], true);
|
||||
add(smokeLeft);
|
||||
|
||||
var smokeRight:BGSprite = new BGSprite('smokeRight', 1100, -100, 0.4, 0.4, ['SmokeRight'], true);
|
||||
add(smokeRight);
|
||||
|
||||
// tankGround.
|
||||
|
||||
tankWatchtower = new BGSprite('tankWatchtower', 100, 50, 0.5, 0.5, ['watchtower gradient color']);
|
||||
|
@ -991,7 +984,12 @@ class PlayState extends MusicBeatState
|
|||
|
||||
for (prop in parsed.propsBackground)
|
||||
{
|
||||
var funnyProp:BGSprite = new BGSprite(prop.path, prop.x, prop.y, prop.scrollX, prop.scrollY);
|
||||
var funnyProp:BGSprite = new BGSprite(prop.path, prop.x, prop.y, prop.scrollX, prop.scrollY, null, false, false);
|
||||
|
||||
if (prop.animBullshit != null)
|
||||
funnyProp.setupSparrow(prop.path, prop.animBullshit.anims, prop.animBullshit.isLooping);
|
||||
else
|
||||
funnyProp.justLoadImage(prop.path);
|
||||
|
||||
funnyProp.setGraphicSize(Std.int(funnyProp.width * prop.scaleX), Std.int(funnyProp.height * prop.scaleY));
|
||||
funnyProp.updateHitbox();
|
||||
|
@ -3203,4 +3201,11 @@ typedef Props =
|
|||
var path:String;
|
||||
var scaleX:Float;
|
||||
var scaleY:Float;
|
||||
var ?animBullshit:PropAnimData;
|
||||
}
|
||||
|
||||
typedef PropAnimData =
|
||||
{
|
||||
var isLooping:Bool;
|
||||
var anims:Array<String>;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue