mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-06 07:50:22 +01:00
Minor tweaks to Pong and Dodge the Creeps
This commit is contained in:
@@ -12,17 +12,17 @@ func _ready():
|
||||
peer.connect("session_description_created", self, "_on_session")
|
||||
|
||||
# Register to the local signaling server (see below for the implementation).
|
||||
Signaling.register(get_path())
|
||||
Signaling.register(String(get_path()))
|
||||
|
||||
|
||||
func _on_ice_candidate(mid, index, sdp):
|
||||
# Send the ICE candidate to the other peer via signaling server.
|
||||
Signaling.send_candidate(get_path(), mid, index, sdp)
|
||||
Signaling.send_candidate(String(get_path()), mid, index, sdp)
|
||||
|
||||
|
||||
func _on_session(type, sdp):
|
||||
# Send the session to other peer via signaling server.
|
||||
Signaling.send_session(get_path(), type, sdp)
|
||||
Signaling.send_session(String(get_path()), type, sdp)
|
||||
# Set generated description as local.
|
||||
peer.set_local_description(type, sdp)
|
||||
|
||||
@@ -32,7 +32,7 @@ func _process(delta):
|
||||
peer.poll()
|
||||
if channel.get_ready_state() == WebRTCDataChannel.STATE_OPEN:
|
||||
while channel.get_available_packet_count() > 0:
|
||||
print(get_path(), " received: ", channel.get_packet().get_string_from_utf8())
|
||||
print(String(get_path()), " received: ", channel.get_packet().get_string_from_utf8())
|
||||
|
||||
|
||||
func send_message(message):
|
||||
|
||||
@@ -10,8 +10,8 @@ func _ready():
|
||||
|
||||
# Wait a second and send message from P1
|
||||
yield(get_tree().create_timer(1), "timeout")
|
||||
p1.send_message("Hi from %s" % p1.get_path())
|
||||
p1.send_message("Hi from %s" % String(p1.get_path()))
|
||||
|
||||
# Wait a second and send message from P2
|
||||
yield(get_tree().create_timer(1), "timeout")
|
||||
p2.send_message("Hi from %s" % p2.get_path())
|
||||
p2.send_message("Hi from %s" % String(p2.get_path()))
|
||||
|
||||
Reference in New Issue
Block a user