allow disabling prop autoplacement
This commit is contained in:
@@ -478,27 +478,30 @@
|
||||
(var PROP_MIN_WIDTH 200)
|
||||
(var PROP_MAX_WIDTH 500)
|
||||
|
||||
(prop &mut :Bool autoPlaceProps true)
|
||||
|
||||
(method :Void showProp [:FlxSprite prop :StagePosition position :Continuation cc]
|
||||
(set prop.cameras [flxMovie.screenCamera])
|
||||
(let [width (min (max prop.width PROP_MIN_WIDTH) PROP_MAX_WIDTH)]
|
||||
(prop.setGraphicSize width)
|
||||
(when autoPlaceProps
|
||||
(prop.setGraphicSize width)
|
||||
|
||||
(prop.updateHitbox)
|
||||
// if the prop is too tall, shrink it heightwise
|
||||
(when (> prop.height flxMovie.DIALOG_Y)
|
||||
(prop.setGraphicSize 0 (Std.int flxMovie.DIALOG_Y))
|
||||
(prop.updateHitbox))
|
||||
(prop.updateHitbox)
|
||||
// if the prop is too tall, shrink it heightwise
|
||||
(when (> prop.height flxMovie.DIALOG_Y)
|
||||
(prop.setGraphicSize 0 (Std.int flxMovie.DIALOG_Y))
|
||||
(prop.updateHitbox))
|
||||
|
||||
(set prop.x (- position.x (/ prop.width 2)))
|
||||
(set prop.y (- position.y (/ prop.height 2)))
|
||||
(set prop.x (- position.x (/ prop.width 2)))
|
||||
(set prop.y (- position.y (/ prop.height 2)))
|
||||
|
||||
(let [propBottom (+ prop.y prop.height)]
|
||||
// if a prop would block the dialogue box, bump it up
|
||||
(when (> propBottom flxMovie.DIALOG_Y)
|
||||
(-= prop.y (- propBottom flxMovie.DIALOG_Y)))
|
||||
// If a prop goes below the edge, bring it up
|
||||
(when (> propBottom FlxG.height)
|
||||
(-= prop.y (- propBottom FlxG.height))))
|
||||
(let [propBottom (+ prop.y prop.height)]
|
||||
// if a prop would block the dialogue box, bump it up
|
||||
(when (> propBottom flxMovie.DIALOG_Y)
|
||||
(-= prop.y (- propBottom flxMovie.DIALOG_Y)))
|
||||
// If a prop goes below the edge, bring it up
|
||||
(when (> propBottom FlxG.height)
|
||||
(-= prop.y (- propBottom FlxG.height)))))
|
||||
|
||||
(let [layerNum position.z]
|
||||
(assertEquals layerNum (Std.int layerNum))
|
||||
|
Reference in New Issue
Block a user