18 lines
503 B
GDScript3
Raw Normal View History

2024-01-26 21:45:26 +00:00
extends PacketHandler
func _ready():
%PlayerAdd.main_player_spawned.connect(on_main_player_spawned)
func on_main_player_spawned(player: Player):
2024-02-15 15:28:27 +00:00
player.controller.jumped.connect(on_jump)
2024-01-26 21:45:26 +00:00
func on_jump():
var buffer := StreamPeerBuffer.new()
buffer.put_8(PacketHandler.Packet.PLAYER_JUMP)
%Client.send(buffer.data_array)
2024-01-29 22:16:06 +00:00
func handle_packet(data: PackedByteArray):
2024-01-26 21:45:26 +00:00
var player_id := data.get_string_from_ascii()
2024-01-28 18:18:16 +00:00
var player := Global.players.get_player(player_id)
2024-02-15 15:28:27 +00:00
player.controller.jumped.emit()