flip ActorFlxSprite depending on facing
This commit is contained in:
@@ -3,6 +3,7 @@ package hollywoo_flixel;
|
|||||||
import kiss.Prelude;
|
import kiss.Prelude;
|
||||||
import kiss.List;
|
import kiss.List;
|
||||||
import flixel.FlxSprite;
|
import flixel.FlxSprite;
|
||||||
|
import hollywoo_flixel.FlxMovie;
|
||||||
|
|
||||||
typedef AnimationArgs = {
|
typedef AnimationArgs = {
|
||||||
name:String,
|
name:String,
|
||||||
|
@@ -1,5 +1,10 @@
|
|||||||
(defNew [:String assetPath &opt frameWidth frameHeight :Map<String,AnimationArgs> animations]
|
(prop :FlxStageFacing defaultFacing)
|
||||||
|
|
||||||
|
(defNew [:String assetPath &opt frameWidth frameHeight :FlxStageFacing defaultFacing :Map<String,AnimationArgs> animations]
|
||||||
(super)
|
(super)
|
||||||
|
|
||||||
|
(set this.defaultFacing (or defaultFacing Right))
|
||||||
|
|
||||||
(if (and frameWidth frameHeight)
|
(if (and frameWidth frameHeight)
|
||||||
(loadGraphic assetPath true frameWidth frameHeight)
|
(loadGraphic assetPath true frameWidth frameHeight)
|
||||||
(loadGraphic assetPath))
|
(loadGraphic assetPath))
|
||||||
|
@@ -22,7 +22,8 @@
|
|||||||
|
|
||||||
(method :Void showCharacter [:Character<FlxStagePosition,FlxStageFacing,ActorFlxSprite> character :Appearance appearance :Continuation cc]
|
(method :Void showCharacter [:Character<FlxStagePosition,FlxStageFacing,ActorFlxSprite> character :Appearance appearance :Continuation cc]
|
||||||
// TODO on the first appearance, show name and description (maybe? also probably not for all?)
|
// TODO on the first appearance, show name and description (maybe? also probably not for all?)
|
||||||
// TODO flip sprite if facing left, and also allow for manually defined flipped frames so text doesn't mirror
|
// TODO also allow for manually defined flipped frames so text doesn't mirror
|
||||||
|
(set character.actor.flipX ?!(= character.stageFacing character.actor.defaultFacing))
|
||||||
(character.actor.setGraphicSize ACTOR_WIDTH)
|
(character.actor.setGraphicSize ACTOR_WIDTH)
|
||||||
(set character.actor.x
|
(set character.actor.x
|
||||||
(- (case character.stagePosition
|
(- (case character.stagePosition
|
||||||
|
Reference in New Issue
Block a user