From 56585a5fd933c206a1fc51725dfa81b65d86b58f Mon Sep 17 00:00:00 2001 From: RandomityGuy <31925790+RandomityGuy@users.noreply.github.com> Date: Sun, 30 Jun 2024 11:10:27 +0530 Subject: [PATCH] fix dyn joystick bounds --- src/touch/MovementInput.hx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/touch/MovementInput.hx b/src/touch/MovementInput.hx index a78acffb..891c4ff1 100644 --- a/src/touch/MovementInput.hx +++ b/src/touch/MovementInput.hx @@ -105,7 +105,9 @@ class MovementInput { public function moveToFinger(e:hxd.Event) { var size = Settings.touchSettings.joystickSize; - this.area.graphics.setPosition(e.relX - size * 3, e.relY - size * 3); + var scene2d = collider.getScene(); + this.area.graphics.setPosition(Util.clamp(e.relX - size * 3, 0, scene2d.width / 2 - size * 6), + Util.clamp(e.relY - size * 3, 0, scene2d.height - size * 6)); this.collider.onPush(e); } @@ -125,6 +127,7 @@ class MovementInput { } public function dispose() { + this.collider.stopCapture(); this.area.dispose(); } }