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

@@ -481,13 +481,13 @@
(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])
(let [width (min (max prop.width PROP_MIN_WIDTH) PROP_MAX_WIDTH)]
(when autoPlaceProps
(whenLet [FirstAppearance appearance]
(prop.setGraphicSize width)
(prop.updateHitbox)
(prop.updateHitbox))
(when autoPlaceProps
// if the prop is too tall, shrink it heightwise
(when (> prop.height 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 "ScreenLowerRight" (new StagePosition right 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))