fix dyn joystick bounds

This commit is contained in:
RandomityGuy 2024-06-30 11:10:27 +05:30
parent aa18bdde74
commit ec5662a835

View file

@ -105,7 +105,9 @@ class MovementInput {
public function moveToFinger(e:hxd.Event) { public function moveToFinger(e:hxd.Event) {
var size = Settings.touchSettings.joystickSize; 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); this.collider.onPush(e);
} }
@ -125,6 +127,7 @@ class MovementInput {
} }
public function dispose() { public function dispose() {
this.collider.stopCapture();
this.area.dispose(); this.area.dispose();
} }
} }