adopt the new scheme for keeping actor/prop positions tracked

This commit is contained in:
2024-10-16 16:17:00 -05:00
parent 0de4137280
commit 37e921f188
3 changed files with 7 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
# @install: lix --silent download "gh://github.com/kiss-lang/hollywoo#cc37d8d33bccb9507af9418171ac1ae809c53660" into hollywoo/0.0.0/github/cc37d8d33bccb9507af9418171ac1ae809c53660
# @run: haxelib run-dir hollywoo "${HAXE_LIBCACHE}/hollywoo/0.0.0/github/cc37d8d33bccb9507af9418171ac1ae809c53660"
# @install: lix --silent download "gh://github.com/kiss-lang/hollywoo#bdba63cc6132c347bd98045bb30bbae3022ca0b5" into hollywoo/0.0.0/github/bdba63cc6132c347bd98045bb30bbae3022ca0b5
# @run: haxelib run-dir hollywoo "${HAXE_LIBCACHE}/hollywoo/0.0.0/github/bdba63cc6132c347bd98045bb30bbae3022ca0b5"
-lib kiss
-lib kiss-tools
-cp ${HAXE_LIBCACHE}/hollywoo/0.0.0/github/cc37d8d33bccb9507af9418171ac1ae809c53660/src/
-cp ${HAXE_LIBCACHE}/hollywoo/0.0.0/github/bdba63cc6132c347bd98045bb30bbae3022ca0b5/src/
-D hollywoo=0.0.0

View File

@@ -1141,12 +1141,3 @@
(method :FlxLightSource offsetLightSource [:FlxLightSource source :StagePosition offset]
(new FlxLightSource (for point source.points (FlxPoint.get (+ point.x offset.x) (+ point.y offset.y))) source.color))
// I'll be proven wrong, but for now I actually think position
// is a reasonable indicator of identity for props and actors
// that are *currently* in the scene:
(method :Bool propEquals [:FlxSprite propA :FlxSprite propB]
(and (= propA.x propB.x) (= propA.y propB.y)))
(method :Bool actorEquals [:ActorFlxSprite actorA :ActorFlxSprite actorB]
(and (= actorA.x actorB.x) (= actorA.y actorB.y)))

View File

@@ -219,18 +219,8 @@
(linearMotion skipping cSprite (+ destX xOffset) (+ destY yOffset) speed (when (= lastCSprite cSprite) cc))))))
@:keep
(method linearMotionTo [:Bool skipping :FlxSprite sprite :String positionKey :Float speed &opt :Void->Void cc :String soundLoop :Float volumeMod :Array<FlxSprite> connectedSprites]
(let [holderType (typeCase [sprite]
// Try-catch: Sometimes I've used ActorFlxSprite for props
([:ActorFlxSprite actorSprite]
(try
(hollywoo.Movie.PositionHolder.Actor
(getActorName actorSprite))
(catch [e]
(hollywoo.Movie.PositionHolder.Prop (getPropName actorSprite)))))
([:FlxSprite propSprite] (hollywoo.Movie.PositionHolder.Prop (getPropName propSprite)))
(never otherwise))
position (resolvePosition positionKey holderType)]
(method linearMotionTo [:Bool skipping :FlxSprite sprite :String spriteKey :String positionKey :Float speed &opt :Void->Void cc :String soundLoop :Float volumeMod :Array<FlxSprite> connectedSprites]
(let [position (resolvePosition positionKey spriteKey)]
(linearMotion skipping sprite position.x position.y speed cc soundLoop volumeMod connectedSprites)))
(defMacro _linearMotionTo [withMacro await objectKey positionKey speed soundLoop volumeMod connectedSprites]
@@ -238,6 +228,7 @@
(linearMotionTo
skipping
o
realKey_o
,positionKey
,speed
,(if (eval await) `cc `null)