only scale props on first appearance

This commit is contained in:
2023-05-25 16:51:58 -06:00
parent cebcf7de60
commit df5b85a401
3 changed files with 17 additions and 8 deletions

View File

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

View File

@@ -481,13 +481,13 @@
(prop &mut :Bool autoPlaceProps true) (prop &mut :Bool autoPlaceProps true)
(method :Void showProp [:FlxSprite prop :StagePosition position :Continuation cc] (method :Void showProp [:FlxSprite prop :StagePosition position :Appearance appearance :Continuation cc]
(set prop.cameras [flxMovie.screenCamera]) (set prop.cameras [flxMovie.screenCamera])
(let [width (min (max prop.width PROP_MIN_WIDTH) PROP_MAX_WIDTH)] (let [width (min (max prop.width PROP_MIN_WIDTH) PROP_MAX_WIDTH)]
(when autoPlaceProps (whenLet [FirstAppearance appearance]
(prop.setGraphicSize width) (prop.setGraphicSize width)
(prop.updateHitbox))
(prop.updateHitbox) (when autoPlaceProps
// if the prop is too tall, shrink it heightwise // if the prop is too tall, shrink it heightwise
(when (> prop.height flxMovie.DIALOG_Y) (when (> prop.height flxMovie.DIALOG_Y)
(prop.setGraphicSize 0 (Std.int flxMovie.DIALOG_Y)) (prop.setGraphicSize 0 (Std.int flxMovie.DIALOG_Y))

View File

@@ -183,4 +183,13 @@
(stagePositions.put "ScreenLowerLeft" (new StagePosition left lower layer)) (stagePositions.put "ScreenLowerLeft" (new StagePosition left lower layer))
(stagePositions.put "ScreenLowerRight" (new StagePosition right lower layer)) (stagePositions.put "ScreenLowerRight" (new StagePosition right lower layer))
(stagePositions.put "ScreenLowerCenter" (new StagePosition centerX lower layer)) (stagePositions.put "ScreenLowerCenter" (new StagePosition centerX lower layer))
(stagePositions.put "ScreenUpperCenter" (new StagePosition centerX upper layer)))) (stagePositions.put "ScreenUpperCenter" (new StagePosition centerX upper layer))))
(method overlayPropOnCurrentSet [propKey :Void->Void cc]
(withProp propKey p
(withSceneSetCC sceneKey bg
(p.setGraphicSize (Std.int bg.width) (Std.int bg.height))
(p.updateHitbox)
(set p.x bg.x)
(set p.y bg.y)))
(cc))