add characters to hollywoo scenes
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
(defNew [:String assetPath &opt :Int frameWidth :Int frameHeight :Map<String,AnimationArgs> animations]
|
(defNew [:String assetPath &opt frameWidth frameHeight :Map<String,AnimationArgs> animations]
|
||||||
(super)
|
(super)
|
||||||
(if (and frameWidth frameHeight)
|
(if (and frameWidth frameHeight)
|
||||||
(loadGraphic assetPath frameWidth frameHeight)
|
(loadGraphic assetPath true frameWidth frameHeight)
|
||||||
(loadGraphic assetPath))
|
(loadGraphic assetPath))
|
||||||
(when animations
|
(when animations
|
||||||
(doFor =>name animationArgs animations
|
(doFor =>name animationArgs animations
|
||||||
|
|||||||
@@ -11,11 +11,24 @@
|
|||||||
(set actionManager.resetOnStateSwitch NONE))
|
(set actionManager.resetOnStateSwitch NONE))
|
||||||
|
|
||||||
(method :Void showScene [:Scene<String,FlxStagePosition,FlxStageFacing,FlxScreenPosition,ActorFlxSprite> scene :Appearance appearance :Continuation cc]
|
(method :Void showScene [:Scene<String,FlxStagePosition,FlxStageFacing,FlxScreenPosition,ActorFlxSprite> scene :Appearance appearance :Continuation cc]
|
||||||
|
// TODO on the first appearance, give a super (for some scenes but probably not others... hm....)
|
||||||
(FlxG.switchState (cast scene SceneFlxState))
|
(FlxG.switchState (cast scene SceneFlxState))
|
||||||
(cc))
|
(cc))
|
||||||
|
|
||||||
|
(var STAGE_LEFT_X 40)
|
||||||
|
(var STAGE_RIGHT_X 1240)
|
||||||
|
(var ACTOR_Y 500)
|
||||||
|
|
||||||
(method :Void showCharacter [:Character<FlxStagePosition,FlxStageFacing,ActorFlxSprite> character :Appearance appearance :Continuation cc]
|
(method :Void showCharacter [:Character<FlxStagePosition,FlxStageFacing,ActorFlxSprite> character :Appearance appearance :Continuation cc]
|
||||||
(print "Character shneezy")
|
// 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
|
||||||
|
(set character.actor.x (case character.stagePosition
|
||||||
|
(Left
|
||||||
|
STAGE_LEFT_X)
|
||||||
|
(Right
|
||||||
|
STAGE_RIGHT_X)))
|
||||||
|
(set character.actor.y ACTOR_Y)
|
||||||
|
(FlxG.state.add character.actor)
|
||||||
(cc))
|
(cc))
|
||||||
|
|
||||||
(prop &mut :Null<Continuation> nextCC)
|
(prop &mut :Null<Continuation> nextCC)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package hollywoo;
|
|||||||
import kiss.AsyncEmbeddedScript;
|
import kiss.AsyncEmbeddedScript;
|
||||||
import kiss.Prelude;
|
import kiss.Prelude;
|
||||||
import hollywoo.Scene;
|
import hollywoo.Scene;
|
||||||
|
import hollywoo.Director;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model/controller of a Hollywoo film, and main execution script
|
* Model/controller of a Hollywoo film, and main execution script
|
||||||
|
|||||||
@@ -6,6 +6,17 @@
|
|||||||
// Mutable representation of frames in time:
|
// Mutable representation of frames in time:
|
||||||
// var scenes:Map<String, Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor>> = [];
|
// var scenes:Map<String, Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor>> = [];
|
||||||
(prop :Map<String,Bool> shownScenes (new Map))
|
(prop :Map<String,Bool> shownScenes (new Map))
|
||||||
|
(prop :Map<String,Bool> shownCharacters (new Map))
|
||||||
|
(function :Appearance appearanceFlag [:Map<String,Bool> map :String key]
|
||||||
|
(if (dictGet map key)
|
||||||
|
ReAppearance
|
||||||
|
{
|
||||||
|
(dictSet map key true)
|
||||||
|
FirstAppearance
|
||||||
|
}))
|
||||||
|
|
||||||
|
(prop &mut :String sceneKey "")
|
||||||
|
(method _currentScene [] (dictGet scenes sceneKey))
|
||||||
|
|
||||||
(defNew
|
(defNew
|
||||||
[
|
[
|
||||||
@@ -36,16 +47,30 @@
|
|||||||
(cc))
|
(cc))
|
||||||
|
|
||||||
(method setScene [name :Continuation cc]
|
(method setScene [name :Continuation cc]
|
||||||
|
(set sceneKey name)
|
||||||
(director.showScene
|
(director.showScene
|
||||||
(dictGet scenes name)
|
(dictGet scenes name)
|
||||||
(if (dictGet shownScenes name)
|
(appearanceFlag shownScenes name)
|
||||||
ReAppearance
|
|
||||||
{
|
|
||||||
(dictSet shownScenes name true)
|
|
||||||
FirstAppearance
|
|
||||||
})
|
|
||||||
cc))
|
cc))
|
||||||
|
|
||||||
(method newActor [name :Actor actor :Continuation cc]
|
(method newActor [name :Actor actor :Continuation cc]
|
||||||
(dictSet actors name actor)
|
(dictSet actors name actor)
|
||||||
(cc))
|
(cc))
|
||||||
|
|
||||||
|
(method addCharacter [actorName :StagePosition position :StageFacing facing :Continuation cc]
|
||||||
|
(let [character (object stagePosition position stageFacing facing actor (dictGet actors actorName))]
|
||||||
|
(dictSet .characters (_currentScene) actorName character)
|
||||||
|
(director.showCharacter
|
||||||
|
character
|
||||||
|
(appearanceFlag shownCharacters actorName)
|
||||||
|
cc)
|
||||||
|
))
|
||||||
|
|
||||||
|
/* TODO
|
||||||
|
(method removeCharacter [
|
||||||
|
|
||||||
|
])
|
||||||
|
*/
|
||||||
|
|
||||||
|
// TODO moveCharacter remove them, add them to another scene
|
||||||
|
// TODO moveCharacterAndFollow remove them, add them to another scene, set that the scene
|
||||||
Reference in New Issue
Block a user