From 010caf26e315835c601f0e97521a52aa72185942 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Tue, 14 Dec 2021 23:05:34 -0700 Subject: [PATCH] fix prop and actor sizing/positioning --- .../hollywoo-flixel/src/hollywoo_flixel/FlxDirector.kiss | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/projects/hollywoo-flixel/src/hollywoo_flixel/FlxDirector.kiss b/projects/hollywoo-flixel/src/hollywoo_flixel/FlxDirector.kiss index ff5e3899..19273055 100644 --- a/projects/hollywoo-flixel/src/hollywoo_flixel/FlxDirector.kiss +++ b/projects/hollywoo-flixel/src/hollywoo_flixel/FlxDirector.kiss @@ -32,6 +32,7 @@ // TODO also allow for manually defined flipped frames so text doesn't mirror (set character.actor.flipX ?!(= character.stageFacing character.actor.defaultFacing)) (character.actor.setGraphicSize ACTOR_WIDTH) + (character.actor.updateHitbox) (set character.actor.x (- (case character.stagePosition (Left @@ -64,7 +65,7 @@ (var DIALOG_WIDTH (- 1280 ACTOR_WIDTH ACTOR_WIDTH)) (var DIALOG_Y 500) (var DIALOG_HEIGHT (- 720 DIALOG_Y)) -// TODO these could be customizable to the Actor +// TODO these could be customizable to the Actor, wrylies, etc. (var DIALOG_BOX_COLOR FlxColor.BLACK) (var DIALOG_COLOR FlxColor.WHITE) (var DIALOG_SIZE 24) @@ -142,18 +143,20 @@ (method :Void stopSong [] (when music (music.stop))) (var PROP_MIN_WIDTH 200) -(var PROP_MAX_WIDTH 500) +(var PROP_MAX_WIDTH 300) (method :Void showPropOnScreen [:FlxSprite prop :FlxScreenPosition position :Continuation cc] // TODO assign the other possible positions + // TODO allow absolute position and relative position by screen percentages (let [[x y] (case position (Center [(/ 1280 2) (/ 720 2)]) (otherwise (throw "not implemented")))] (let [width (min (max prop.width PROP_MIN_WIDTH) PROP_MAX_WIDTH)] (prop.setGraphicSize width) + (prop.updateHitbox) (set prop.x (- x (/ prop.width 2))) - (set prop.y (- y (/ (* prop.height prop.scale.y) 2))) + (set prop.y (- y (/ prop.height 2))) (currentState.add prop))) // TODO give the prop reveal some time to land (cc))