position props better

This commit is contained in:
2021-12-29 18:16:47 -07:00
parent 0c13c394ca
commit 0f722b83c6

View File

@@ -159,9 +159,20 @@
(otherwise (throw "not implemented")))]
(let [width (min (max prop.width PROP_MIN_WIDTH) PROP_MAX_WIDTH)]
(prop.setGraphicSize width)
(prop.updateHitbox)
// if the prop is too tall, shrink it heightwise
(when (> prop.height DIALOG_Y)
(prop.setGraphicSize 0 DIALOG_Y)
(prop.updateHitbox))
(set prop.x (- x (/ prop.width 2)))
(set prop.y (- y (/ prop.height 2)))
// if the prop would block the dialogue box, bump it up
(let [propBottom (+ prop.y prop.height)]
(when (> propBottom DIALOG_Y)
(-= prop.y (- propBottom DIALOG_Y))))
(currentState.add prop)))
// TODO give the prop reveal some time to land
(cc))