From 80e7342650a9d71b73a838230733c54c50ffcc1b Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Wed, 22 Jan 2025 21:17:25 +0500 Subject: upd: Vector2 instead of Vector3 for directions (because we don't actually need the y coordinate) --- .../main/java/kz/ilotterytea/frogartha/server/ServerHandlers.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'server') diff --git a/server/src/main/java/kz/ilotterytea/frogartha/server/ServerHandlers.java b/server/src/main/java/kz/ilotterytea/frogartha/server/ServerHandlers.java index 621affd..6f16281 100644 --- a/server/src/main/java/kz/ilotterytea/frogartha/server/ServerHandlers.java +++ b/server/src/main/java/kz/ilotterytea/frogartha/server/ServerHandlers.java @@ -1,5 +1,6 @@ package kz.ilotterytea.frogartha.server; +import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector3; import kz.ilotterytea.frogartha.FrogarthaConstants; import kz.ilotterytea.frogartha.domain.Identity; @@ -54,7 +55,7 @@ public class ServerHandlers { Vector3 startPosition = position.cpy(); float jumpDistance = action.getJumpStrength() * FrogarthaConstants.Player.JUMP_SPEED; - Vector3 d = new Vector3(state.getDirection()).sub(startPosition).nor(); + Vector3 d = new Vector3(state.getDirection().x, state.getPosition().y, state.getDirection().y).sub(startPosition).nor(); Vector3 endPosition = new Vector3( position.x + d.x * jumpDistance, @@ -79,9 +80,9 @@ public class ServerHandlers { } PlayerState state = player.getState(); - Vector3 direction = action.getDirection(); + Vector2 direction = action.getDirection(); - state.setDirection(direction.x, state.getPosition().y, direction.z); + state.setDirection(direction.x, direction.y); ChangedDirectionEvent event = new ChangedDirectionEvent(player.getId(), state.getDirection()); -- cgit v1.2.3