Added character select screen
parent
e88246b5b1
commit
415ac79531
|
@ -0,0 +1,4 @@
|
|||
extends Control
|
||||
|
||||
func spawn():
|
||||
get_parent().get_parent().spawn(get_tree().get_network_unique_id())
|
|
@ -0,0 +1,48 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://CharacterSelect.gd" type="Script" id=1]
|
||||
[ext_resource path="res://GUI/theme.tres" type="Theme" id=2]
|
||||
|
||||
[node name="CharacterSelect" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme = ExtResource( 2 )
|
||||
use_top_left = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
|
||||
margin_left = -146.0
|
||||
margin_top = -50.0
|
||||
margin_right = 146.0
|
||||
margin_bottom = 50.0
|
||||
|
||||
[node name="CharacterList" type="HBoxContainer" parent="CenterContainer/VBoxContainer"]
|
||||
margin_right = 292.0
|
||||
margin_bottom = 48.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Button" type="Button" parent="CenterContainer/VBoxContainer/CharacterList"]
|
||||
margin_right = 292.0
|
||||
margin_bottom = 48.0
|
||||
text = "Her Majesty the Queen"
|
||||
|
||||
[node name="SelectButton" type="Button" parent="CenterContainer/VBoxContainer"]
|
||||
margin_left = 102.0
|
||||
margin_top = 52.0
|
||||
margin_right = 190.0
|
||||
margin_bottom = 100.0
|
||||
size_flags_horizontal = 4
|
||||
text = "Select"
|
||||
[connection signal="pressed" from="CenterContainer/VBoxContainer/SelectButton" to="." method="spawn"]
|
19
Game.gd
19
Game.gd
|
@ -190,10 +190,10 @@ func initialize_client():
|
|||
func initialize():
|
||||
return_to_menu("MainMenu")
|
||||
|
||||
$MenuContainer/MainMenu/Connect.hide()
|
||||
$MenuContainer/MainMenu/Disconnect.show()
|
||||
#$MenuContainer/MainMenu/Connect.hide()
|
||||
#$MenuContainer/MainMenu/Disconnect.show()
|
||||
|
||||
close_menus()
|
||||
#close_menus()
|
||||
|
||||
func free_client():
|
||||
$MenuContainer/MainMenu/Connect.show()
|
||||
|
@ -259,6 +259,19 @@ func join_game():
|
|||
var player_data = get_player_data()
|
||||
|
||||
rpc("set_player_data", player_data)
|
||||
|
||||
player.hide()
|
||||
open_menu("CharacterSelectScreen")
|
||||
|
||||
|
||||
sync func spawn(player_id):
|
||||
var spawning_player = $Players.get_node(str(player_id))
|
||||
|
||||
$Level.show()
|
||||
|
||||
spawning_player.spawn()
|
||||
spawning_player.show()
|
||||
close_menus()
|
||||
|
||||
func on_player_added(player):
|
||||
var player_list_item = preload("res://PlayerListItem.tscn").instance()
|
||||
|
|
13
Game.tscn
13
Game.tscn
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=6 format=2]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://GUI/theme.tres" type="Theme" id=1]
|
||||
[ext_resource path="res://Game.gd" type="Script" id=2]
|
||||
[ext_resource path="res://Level.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://CharacterSelect.tscn" type="PackedScene" id=4]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
|
@ -44,6 +45,7 @@ SERVER_IP = "127.0.0.1"
|
|||
environment = SubResource( 2 )
|
||||
|
||||
[node name="Level" parent="." instance=ExtResource( 3 )]
|
||||
visible = false
|
||||
|
||||
[node name="Players" type="Spatial" parent="."]
|
||||
|
||||
|
@ -101,6 +103,15 @@ margin_right = 400.0
|
|||
margin_bottom = 256.0
|
||||
text = "Quit"
|
||||
|
||||
[node name="CharacterSelectScreen" parent="MenuContainer" instance=ExtResource( 4 )]
|
||||
visible = false
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 512.0
|
||||
margin_top = 300.0
|
||||
margin_right = 512.0
|
||||
margin_bottom = 300.0
|
||||
|
||||
[node name="ConnectMenu" type="VBoxContainer" parent="MenuContainer"]
|
||||
visible = false
|
||||
margin_left = 312.0
|
||||
|
|
|
@ -17,7 +17,7 @@ onready var health = max_health setget set_health
|
|||
onready var camera = $Camera
|
||||
onready var debug = $Debug
|
||||
|
||||
var is_dead = false
|
||||
var is_dead = true
|
||||
|
||||
#onready var sfx_foosteps = [$"Sounds/Footstep-Concrete-01",
|
||||
# $"Sounds/Footstep-Concrete-02",
|
||||
|
@ -229,8 +229,8 @@ func spawn():
|
|||
|
||||
game.get_spawn_point().spawn(self)
|
||||
|
||||
#$MeshInstance.show()
|
||||
$Camera/Hand.show()
|
||||
$HUD.show()
|
||||
|
||||
$CollisionShapeBody.disabled = false
|
||||
|
||||
|
@ -295,7 +295,7 @@ func _input(event):
|
|||
func set_local_player():
|
||||
set_network_master(get_tree().get_network_unique_id())
|
||||
camera.current = true
|
||||
$HUD.show()
|
||||
#$HUD.show()
|
||||
$Billboard.hide()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
|
|
Reference in New Issue