Persistent player spectating on desktop

This commit is contained in:
Anuken
2024-10-29 10:08:04 -04:00
parent 81282edce9
commit 1558783b7d
4 changed files with 24 additions and 8 deletions

View File

@@ -779,7 +779,11 @@ public class MobileInput extends InputHandler implements GestureListener{
if(!Core.settings.getBool("keyboard") && !locked && !scene.hasKeyboard()){
//move camera around
float camSpeed = 6f;
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta * camSpeed));
Vec2 delta = Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta * camSpeed);
Core.camera.position.add(delta);
if(!delta.isZero()){
spectating = null;
}
}
if(Core.settings.getBool("keyboard")){
@@ -940,6 +944,7 @@ public class MobileInput extends InputHandler implements GestureListener{
//pan player
Core.camera.position.x -= deltaX;
Core.camera.position.y -= deltaY;
spectating = null;
}
camera.position.clamp(-camera.width/4f, -camera.height/4f, world.unitWidth() + camera.width/4f, world.unitHeight() + camera.height/4f);