rotation-aware match zone debug outlines

This commit is contained in:
2022-08-12 22:48:26 +00:00
parent b54eb15e74
commit 3909d5ad6e

View File

@@ -34,16 +34,29 @@
(prop &mut :FlxInputText entryNameText)
(prop :FlxSprite cameraBounds (new FlxSprite))
(prop &mut :Float timer 0)
(method &override :Void update [:Float elapsed]
(super.update elapsed)
(#when debug
(let [b (pieceCamera.getScrollBounds)]
(set cameraBounds.x b.x)
(set cameraBounds.y b.y)
(cameraBounds.makeGraphic (Std.int b.width) (Std.int b.height) FlxColor.TRANSPARENT true)
(cameraBounds.drawRect 0 0 b.width b.height FlxColor.TRANSPARENT (object color FlxColor.LIME thickness 5))))
**(#when debug
(+= timer elapsed)
(when (> timer 0.5)
(set timer 0)
// Debug camera scroll bounds:
(let [b (pieceCamera.getScrollBounds)]
(set cameraBounds.x b.x)
(set cameraBounds.y b.y)
(cameraBounds.makeGraphic (Std.int b.width) (Std.int b.height) FlxColor.TRANSPARENT true)
(cameraBounds.drawRect 0 0 b.width b.height FlxColor.TRANSPARENT (object color FlxColor.LIME thickness 5)))
// Uncomment for debugging match zones:
(doFor s rewardSprites
(let [matchZones [(matchZoneLeft s) (matchZoneRight s)(matchZoneUp s)(matchZoneDown s)]]
(doFor z matchZones
(unless z.isEmpty
(FlxSpriteUtil.drawRect cameraBounds (- z.x cameraBounds.x) (- z.y cameraBounds.y) z.width z.height FlxColor.TRANSPARENT (object thickness 1 color FlxColor.RED))))))))
(pieceCamera.updateScrollWheelZoom elapsed 5)
(pieceCamera.updateMouseBorderControl elapsed KEYBOARD_SCROLL_SPEED 0.002 uiCamera)
@@ -277,12 +290,7 @@
(kiss_flixel.SpriteTools.writeOnSprite "$i" 32 s (object x (Percent 0.5) y (Percent 0.5)) FlxColor.RED))
(set s.cameras [pieceCamera])
// Uncomment for debugging match zones:
**(#when debug
(let [matchZones [(matchZoneLeft s) (matchZoneRight s)(matchZoneUp s)(matchZoneDown s)]]
(doFor z matchZones
(unless z.isEmpty
(FlxSpriteUtil.drawRect s (- z.x s.x) (- z.y s.y) z.width z.height FlxColor.TRANSPARENT (object thickness 1 color FlxColor.RED))))))
(rewardSprites.add s)))
(doFor row (range PUZZLE_HEIGHT)