16 lines
376 B
GDScript
16 lines
376 B
GDScript
extends Node
|
|
|
|
@export var address: String
|
|
@export var port: int
|
|
|
|
func _ready():
|
|
var m = SceneMultiplayer.new()
|
|
get_tree().set_multiplayer(m, get_path())
|
|
var peer := ENetMultiplayerPeer.new()
|
|
peer.create_client(address, port)
|
|
m.multiplayer_peer = peer
|
|
m.connected_to_server.connect(connected_to_server)
|
|
|
|
func connected_to_server():
|
|
print("Client connected to server")
|