Added Disconnect screen

This commit is contained in:
Kristofers Solo 2021-10-30 18:11:59 +03:00
parent f265c7236e
commit e113e1d250
3 changed files with 16 additions and 10 deletions

View File

@ -33,6 +33,7 @@ func _process(delta: float) -> void:
func _physics_process(delta):
if get_tree().has_network_peer():
if is_network_master():
mode_switch(delta)
screen_wrap()
@ -117,6 +118,7 @@ func _network_peer_connected(id) -> void:
func _on_network_tick_rate_timeout():
if get_tree().has_network_peer():
if is_network_master():
rset_unreliable("puppet_position", global_position)
rset_unreliable("puppet_velocity", velocity)

View File

@ -78,7 +78,7 @@ func _client_connection_timeout():
print("Client has been timed out")
reset_network_connection()
var connection_timeout_prompt = Global.instance_node(load("res://Simple_prompt.tscn"), get_tree().current_scene)
var connection_timeout_prompt = Global.instance_node(load("res://scenes/simple_prompt.tscn"), get_tree().current_scene)
connection_timeout_prompt.set_text("Connection timed out")
@ -89,7 +89,7 @@ func _connection_failed():
reset_network_connection()
if Global.ui != null:
var prompt = Global.instance_node(load("res://Simple_prompt.tscn"), Global.ui)
var prompt = Global.instance_node(load("res://scenes/simple_prompt.tscn"), Global.ui)
prompt.set_text("Connection failed")

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://scenes/floor.tscn" type="PackedScene" id=1]
[ext_resource path="res://code/game.gd" type="Script" id=2]
[ext_resource path="res://code/UI.gd" type="Script" id=3]
[node name="game" type="Node2D"]
script = ExtResource( 2 )
@ -23,3 +24,6 @@ position = Vector2( 512, 270 )
[node name="4" type="Position2D" parent="spawn_locations"]
position = Vector2( 1408, 270 )
[node name="UI" type="CanvasLayer" parent="."]
script = ExtResource( 3 )