aboutsummaryrefslogtreecommitdiff
path: root/client/player
diff options
context:
space:
mode:
authornokoe <nokoe@mailbox.org>2025-09-30 00:58:30 +0200
committernokoe <nokoe@mailbox.org>2025-09-30 00:58:30 +0200
commitbd52f4617d04d9b3cda279d48fc75d5a067101fe (patch)
tree2837061a4db510bd97286a95d78fb25db3f9568a /client/player
parent7c92e6c228c3c3e02ceec9af099b1bb133a88a8e (diff)
downloadhurrycurry-bd52f4617d04d9b3cda279d48fc75d5a067101fe.tar
hurrycurry-bd52f4617d04d9b3cda279d48fc75d5a067101fe.tar.bz2
hurrycurry-bd52f4617d04d9b3cda279d48fc75d5a067101fe.tar.zst
marker rotation by item/player rotation
Diffstat (limited to 'client/player')
-rw-r--r--client/player/controllable_player.gd11
-rw-r--r--client/player/player.gd2
2 files changed, 10 insertions, 3 deletions
diff --git a/client/player/controllable_player.gd b/client/player/controllable_player.gd
index 1b00aa8e..deb1f089 100644
--- a/client/player/controllable_player.gd
+++ b/client/player/controllable_player.gd
@@ -316,7 +316,11 @@ func update_interact_target_dirsnap():
if player_tile_distance < MAX_PLAYER_INTERACT_DIST && cursor_tile_distance < best_distance:
found_interact_target = true
best_distance = cursor_tile_distance
- target_visual = game.map.get_tile_instance(offset_cursor).item_base.global_position
+ var tile = game.map.get_tile_instance(offset_cursor)
+ target_visual = tile.item_base.global_position
+ if tile.item != null:
+ marker.rotation.y = tile.item.rotation.y
+ else: marker.rotation.y = 0.
target_tile = offset_cursor
continue
@@ -326,7 +330,8 @@ func update_interact_target_dirsnap():
var best_cursor_tile_distance := 100.
var best_player_tile_distance := 100.
var best_player_pos: Vector3
- for p_id: int in player_positions.keys():
+ var best_player_rot: float
+ for p_id in player_positions.keys():
if p_id == game.my_player_id: continue # I can't interact with myself
var p_pos: Vector3 = player_positions[p_id]
var p_pos_2d := Vector2(p_pos.x, p_pos.z)
@@ -338,9 +343,11 @@ func update_interact_target_dirsnap():
best_cursor_tile_distance = cursor_tile_distance
best_player_tile_distance = player_tile_distance
best_player_pos = p_pos
+ best_player_rot = game.players[p_id].rotation_anim
if best_player_tile_distance < MAX_PLAYER_INTERACT_DIST && best_cursor_tile_distance < best_distance:
found_interact_target = true
best_distance = best_cursor_tile_distance
target_visual = best_player_pos
+ marker.rotation.y = best_player_rot
target_tile = offset_cursor
diff --git a/client/player/player.gd b/client/player/player.gd
index 58ae9732..0ca08742 100644
--- a/client/player/player.gd
+++ b/client/player/player.gd
@@ -24,7 +24,7 @@ const PLAYER_SIZE: float = 0.4
const SPEED: float = 25.
var game: Game
-var id := -1
+var id := -1. # float because json
var rotation_ = 0.
var rotation_anim = 0.
var position_ = Vector2(0, 0)