From d71a8653623008f99910573d9331681d5b90ca33 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Mon, 19 Aug 2024 20:47:24 -0500 Subject: [PATCH] linearmotion macros accept connectedsprites --- src/hollywoo_flixel/HollywooFlixelDSL.kiss | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/hollywoo_flixel/HollywooFlixelDSL.kiss b/src/hollywoo_flixel/HollywooFlixelDSL.kiss index 1e8e7ae..46f1dcb 100644 --- a/src/hollywoo_flixel/HollywooFlixelDSL.kiss +++ b/src/hollywoo_flixel/HollywooFlixelDSL.kiss @@ -189,7 +189,7 @@ position (resolvePosition positionKey holderType)] (linearMotion skipping sprite position.x position.y speed cc soundLoop volumeMod connectedSprites))) -(defMacro _linearMotionTo [withMacro await objectKey positionKey speed soundLoop volumeMod] +(defMacro _linearMotionTo [withMacro await objectKey positionKey speed soundLoop volumeMod connectedSprites] `(,withMacro ,objectKey o (linearMotionTo skipping @@ -198,16 +198,13 @@ ,speed ,(if (eval await) `cc `null) ,soundLoop - ,volumeMod) + ,volumeMod + (array FlxSprite ,@connectedSprites)) ,(if (eval await) `null `(cc)))) -(defMacroFunction tryRead [stream] - (try (read stream) - (catch [e] `null))) - (defMacroFunction awaitLMTReaderMacro [stream withMacro await] (let [nextLineStream (stream.expect "hollywoo macro line" ->(stream.takeLineAsStream)) - exps [(read nextLineStream) (read nextLineStream) (read nextLineStream) (tryRead nextLineStream) (tryRead nextLineStream)]] + exps [(read nextLineStream) (read nextLineStream) (read nextLineStream) (readOr nextLineStream `null) (readOr nextLineStream `null) (readOr nextLineStream `[])]] `(_linearMotionTo ,withMacro ,await ,@exps))) (defReaderMacro "AWAITLINEARMOTIONACTORTO" [stream &builder b] @@ -223,7 +220,7 @@ (awaitLMTReaderMacro stream `withPropCC false)) -(defMacro _linearMotion [withMacro await objectKey _x _y speed soundLoop volumeMod] +(defMacro _linearMotion [withMacro await objectKey _x _y speed soundLoop volumeMod connectedSprites] `(,withMacro ,objectKey o (let [x o.x y o.y] (linearMotion @@ -234,12 +231,16 @@ ,speed ,(if (eval await) `cc `null) ,soundLoop - ,volumeMod)) + ,volumeMod + (array FlxSprite ,@connectedSprites))) ,(if (eval await) `null `(cc)))) +// This looks like duplication of the above, +// but these ones use the version of the function without TO + (defMacroFunction awaitLMReaderMacro [stream withMacro await] (let [nextLineStream (stream.expect "hollywoo macro line" ->(stream.takeLineAsStream)) - exps [(read nextLineStream) (read nextLineStream) (read nextLineStream) (read nextLineStream) (tryRead nextLineStream) (tryRead nextLineStream)]] + exps [(read nextLineStream) (read nextLineStream) (read nextLineStream) (read nextLineStream) (readOr nextLineStream `null) (readOr nextLineStream `null) (readOr nextLineStream `[])]] `(_linearMotion ,withMacro ,await ,@exps))) (defReaderMacro "AWAITLINEARMOTIONACTOR" [stream &builder b]