aboutsummaryrefslogtreecommitdiff
path: root/client/player/controllable_player.gd
diff options
context:
space:
mode:
Diffstat (limited to 'client/player/controllable_player.gd')
-rw-r--r--client/player/controllable_player.gd18
1 files changed, 15 insertions, 3 deletions
diff --git a/client/player/controllable_player.gd b/client/player/controllable_player.gd
index 7501ca0a..8b2da8c2 100644
--- a/client/player/controllable_player.gd
+++ b/client/player/controllable_player.gd
@@ -26,7 +26,8 @@ const BOOST_RESTORE = 0.5
var facing = Vector2(1, 0)
var velocity_ = Vector2(0, 0)
var stamina = 0
-var boosting = false
+var boosting := false
+var chat_open := false
var target: Vector2i = Vector2i(0, 0)
@@ -40,6 +41,15 @@ func _ready():
game.mp.send_position(position_, rotation_)
)
super()
+ bubble.submit_message.connect(submit_message)
+
+func _input(_event):
+ if Input.is_action_just_pressed("chat"):
+ if chat_open:
+ bubble.stop_edit()
+ else:
+ bubble.edit()
+ chat_open = !chat_open
func _process(delta):
var input = Input.get_vector("left", "right", "forward", "backwards")
@@ -106,8 +116,10 @@ func aabb_point_distance(mi: Vector2, ma: Vector2, p: Vector2) -> float:
return (p - p.clamp(mi, ma)).length()
func update_position(new_position: Vector2, _new_rotation: float):
- if (new_position - position_).length() > 3.:
- position_ = new_position
+ pass
+
+func submit_message(text: String):
+ game.mp.send_chat(text)
func interact():
var tile = game.map.get_tile_instance(target)