From 59cdcea03927281cadaab864bbf4fba598a91056 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Thu, 6 Jan 2022 14:21:55 -0700 Subject: [PATCH] swap characters in front/behind positions on speech --- src/hollywoo/Director.hx | 3 ++- src/hollywoo/Movie.kiss | 24 ++++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/hollywoo/Director.hx b/src/hollywoo/Director.hx index 6be537d..1ad9f0f 100644 --- a/src/hollywoo/Director.hx +++ b/src/hollywoo/Director.hx @@ -15,7 +15,8 @@ interface Director, appearance:Appearance, cc:Continuation):Void; function showCharacter(character:Character, appearance:Appearance, cc:Continuation):Void; function hideCharacter(character:Character, cc:Continuation):Void; - function moveCharacter(character:Character, fromPos:StagePosition, fromFacing:StageFacing, toPos:StagePosition, toFacing:StageFacing, cc:Continuation):Void; + function moveCharacter(character:Character, toPos:StagePosition, toFacing:StageFacing, cc:Continuation):Void; + function swapCharacters(a:Character, b:Character, cc:Continuation):Void; function playSound(sound:Sound, volumeMod:Float, waitForEnd:Bool, cc:Continuation):Void; function playSong(song:Song, volumeMod:Float, loop:Bool, waitForEnd:Bool, cc:Continuation):Void; function stopSong():Void; diff --git a/src/hollywoo/Movie.kiss b/src/hollywoo/Movie.kiss index 298ae02..959106f 100644 --- a/src/hollywoo/Movie.kiss +++ b/src/hollywoo/Movie.kiss @@ -231,12 +231,24 @@ (director.hideCharacter c cc))) (hollywooMethod moveCharacter false [actorName :StagePosition newPosition :StageFacing newFacing :Continuation cc] - (let [c (dictGet .characters (_currentScene) actorName) - oldPosition c.stagePosition - oldFacing c.stageFacing] - (set c.stagePosition newPosition) - (set c.stageFacing newFacing) - (director.moveCharacter c oldPosition oldFacing newPosition newFacing cc))) + (let [c (dictGet .characters (_currentScene) actorName)] + (director.moveCharacter c newPosition newFacing ->:Void { + (set c.stagePosition newPosition) + (set c.stageFacing newFacing) + (cc) + }))) + +(hollywooMethod swapCharacters false [actorNameA actorNameB :Continuation cc] + (let [a (dictGet .characters (_currentScene) actorNameA) + b (dictGet .characters (_currentScene) actorNameB)] + (director.swapCharacters a b ->:Void + (let [tempStagePos a.stagePosition + tempStageFacing a.stageFacing] + (set a.stagePosition b.stagePosition) + (set a.stageFacing b.stageFacing) + (set b.stagePosition tempStagePos) + (set b.stageFacing tempStageFacing) + (cc))))) // TODO moveCharacter remove them, add them to another scene // TODO moveCharacterAndFollow remove them, add them to another scene, set that the scene