Movie.newActor and ActorFlxSprite constructor
This commit is contained in:
@@ -4,5 +4,14 @@ import kiss.Prelude;
|
||||
import kiss.List;
|
||||
import flixel.FlxSprite;
|
||||
|
||||
typedef AnimationArgs = {
|
||||
name:String,
|
||||
frames:Array<Int>,
|
||||
?frameRate:Float, // default 30
|
||||
?looped:Bool, // default true
|
||||
?flipX:Bool, // default false
|
||||
?flipY:Bool // default false
|
||||
};
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class ActorFlxSprite extends FlxSprite {}
|
||||
|
@@ -0,0 +1,14 @@
|
||||
(defNew [:String assetPath &opt :Int frameWidth :Int frameHeight :Map<String,AnimationArgs> animations]
|
||||
(super)
|
||||
(if (and frameWidth frameHeight)
|
||||
(loadGraphic assetPath frameWidth frameHeight)
|
||||
(loadGraphic assetPath))
|
||||
(when animations
|
||||
(doFor =>name animationArgs animations
|
||||
(animation.add
|
||||
name
|
||||
animationArgs.frames
|
||||
(or animationArgs.frameRate 30)
|
||||
(or animationArgs.looped true)
|
||||
?animationArgs.flipX
|
||||
?animationArgs.flipY))))
|
@@ -45,3 +45,7 @@
|
||||
FirstAppearance
|
||||
})
|
||||
cc))
|
||||
|
||||
(method newActor [name :Actor actor :Continuation cc]
|
||||
(dictSet actors name actor)
|
||||
(cc))
|
Reference in New Issue
Block a user