mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-26 20:51:38 +00:00
try to make touch camera better
This commit is contained in:
parent
5391c665ac
commit
bc428260fa
2 changed files with 17 additions and 8 deletions
|
|
@ -87,14 +87,24 @@ class CameraInput {
|
||||||
if (jumpcam) {
|
if (jumpcam) {
|
||||||
scaleFactor /= Settings.touchSettings.buttonJoystickMultiplier;
|
scaleFactor /= Settings.touchSettings.buttonJoystickMultiplier;
|
||||||
}
|
}
|
||||||
if (Math.abs(delta.x) < 0.05)
|
var inpX = delta.x / scaleFactor;
|
||||||
delta.x = 0;
|
var inpY = delta.y / scaleFactor;
|
||||||
if (Math.abs(delta.y) < 0.05)
|
|
||||||
delta.y = 0;
|
if (jumpcam) {
|
||||||
MarbleGame.instance.world.marble.camera.orbit(applyNonlinearScale(delta.x / scaleFactor), applyNonlinearScale(delta.y / scaleFactor), true);
|
if (Math.abs(inpX) < 1.3)
|
||||||
if (delta.x != 0)
|
inpX = 0;
|
||||||
|
if (Math.abs(inpY) < 1.3)
|
||||||
|
inpY = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dt = MarbleGame.instance.world.timeState.dt;
|
||||||
|
|
||||||
|
MarbleGame.instance.world.marble.camera.orbit(applyNonlinearScale((inpX / dt) * (1 / 60.0)) * (1 / 60.0) * 20,
|
||||||
|
applyNonlinearScale((inpY / dt) * (1 / 60.0)) * (1 / 60.0) * 20, true);
|
||||||
|
|
||||||
|
if (inpX != 0)
|
||||||
prevMouse.x = e.relX;
|
prevMouse.x = e.relX;
|
||||||
if (delta.y != 0)
|
if (inpY != 0)
|
||||||
prevMouse.y = e.relY;
|
prevMouse.y = e.relY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ class PauseButton extends TouchButton {
|
||||||
|
|
||||||
this.onClick = () -> {
|
this.onClick = () -> {
|
||||||
if (MarbleGame.instance.world != null && @:privateAccess !MarbleGame.instance.paused) {
|
if (MarbleGame.instance.world != null && @:privateAccess !MarbleGame.instance.paused) {
|
||||||
@:privateAccess MarbleGame.instance.paused = true;
|
|
||||||
MarbleGame.instance.handlePauseGame();
|
MarbleGame.instance.handlePauseGame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue