Milestone 3: Freezer

The freezer is now implemented, just as it worked in the original. There are also a few fixes here and there in preparation for Milestonr 4.
This commit is contained in:
patrick_pluto 2024-08-04 13:41:19 +02:00
commit a92202b536
14 changed files with 199 additions and 114 deletions

View file

@ -8,15 +8,36 @@
extends Control
func _ready():
Server.create_game()
if Server.is_server:
$player_customization/ip.hide()
$player_customization/ip.text = "localhost"
$player_customization/ip.editable = false
$start/start.show()
$start/start.disabled = false
$player_list/list.text = " "
func _process(delta):
if Server.is_server:
Server.sync_playerlist.rpc($player_list/list.text)
func _on_start_pressed():
Server.send_playerinfo(get_tree().root.get_node("create/player_customization/name").text, multiplayer.get_unique_id())
Server.start_game.rpc(Server.players)
func _input(event):
if Input.is_action_just_pressed("escape"):
get_tree().change_scene_to_file("res://menus/main_menu.tscn")
func _on_join_pressed():
if $player_customization/name.text != "" and $player_customization/ip.text != "":
if !Server.is_server:
Server.join_game($player_customization/ip.text)
$player_customization/join.hide()
$player_customization/join.disabled = true
$player_customization/name.editable = false
$player_customization/ip.editable = false
while $player_list/list.text == "":
await get_tree().create_timer(0.001).timeout
Server.send_playerinfo.rpc($player_customization/name.text, multiplayer.get_unique_id())