Implemented character preview when selecting character
parent
fe92968dcd
commit
c710838793
|
@ -2,5 +2,5 @@ extends "res://Player.gd"
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
if name == String(get_tree().get_network_unique_id()):
|
if name == String(get_tree().get_network_unique_id()):
|
||||||
print("SELF")
|
return
|
||||||
#$Throne/Cube.cast_shadow = 3
|
#$Throne/Cube.cast_shadow = 3
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
|
func set_character(packed_character):
|
||||||
# Called when the node enters the scene tree for the first time.
|
var character = packed_character.instance()
|
||||||
func _ready():
|
character.show_healthbar = false
|
||||||
pass # Replace with function body.
|
|
||||||
|
$Viewport.add_child(character)
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
$Viewport.size = rect_size
|
$Viewport.size = rect_size
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Assets/Characters/HerMajestyTheQueen/HerMajestyTheQueen.tscn" type="PackedScene" id=1]
|
|
||||||
[ext_resource path="res://GUI/CharacterOption.gd" type="Script" id=2]
|
[ext_resource path="res://GUI/CharacterOption.gd" type="Script" id=2]
|
||||||
|
|
||||||
[sub_resource type="ViewportTexture" id=1]
|
[sub_resource type="ViewportTexture" id=1]
|
||||||
|
@ -9,6 +8,9 @@ viewport_path = NodePath("Viewport")
|
||||||
[node name="CharacterOption" type="Control"]
|
[node name="CharacterOption" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
margin_right = -824.0
|
||||||
|
margin_bottom = -300.0
|
||||||
|
rect_min_size = Vector2( 200, 300 )
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
|
@ -25,12 +27,14 @@ __meta__ = {
|
||||||
|
|
||||||
[node name="Viewport" type="Viewport" parent="."]
|
[node name="Viewport" type="Viewport" parent="."]
|
||||||
size = Vector2( 500, 500 )
|
size = Vector2( 500, 500 )
|
||||||
|
own_world = true
|
||||||
transparent_bg = true
|
transparent_bg = true
|
||||||
msaa = 2
|
|
||||||
render_target_v_flip = true
|
render_target_v_flip = true
|
||||||
|
|
||||||
[node name="Camera" type="Camera" parent="Viewport"]
|
[node name="Camera" type="Camera" parent="Viewport"]
|
||||||
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 1.38191, -6.32464 )
|
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 1.38191, -8.49631 )
|
||||||
fov = 39.6532
|
fov = 39.6532
|
||||||
|
|
||||||
[node name="HerMajestyTheQueen" parent="Viewport" instance=ExtResource( 1 )]
|
[node name="DirectionalLight" type="DirectionalLight" parent="Viewport"]
|
||||||
|
transform = Transform( 1, 0, 0, 0, -0.361787, 0.932261, 0, -0.932261, -0.361787, 0, 3.34228, -3.37409 )
|
||||||
|
light_energy = 2.9
|
||||||
|
|
|
@ -5,8 +5,23 @@ onready var game = get_parent().get_parent()
|
||||||
func _ready():
|
func _ready():
|
||||||
var dir = Directory.new()
|
var dir = Directory.new()
|
||||||
dir.open("res://Assets/Characters/")
|
dir.open("res://Assets/Characters/")
|
||||||
|
dir.list_dir_begin()
|
||||||
|
|
||||||
#$CenterContainer/VBoxContainer/CharacterList.add_child(null)
|
var file = dir.get_next()
|
||||||
|
while file != "":
|
||||||
|
if not file.begins_with("."):
|
||||||
|
# Add character
|
||||||
|
add_character(file)
|
||||||
|
|
||||||
|
file = dir.get_next()
|
||||||
|
|
||||||
|
func add_character(character_name):
|
||||||
|
var path = "res://Assets/Characters/" + character_name + "/" + character_name + ".tscn"
|
||||||
|
var packed_character = load(path)
|
||||||
|
|
||||||
|
var character_option = preload("res://GUI/CharacterOption.tscn").instance()
|
||||||
|
$CenterContainer/VBoxContainer/CharacterList.add_child(character_option)
|
||||||
|
character_option.set_character(packed_character)
|
||||||
|
|
||||||
func spawn():
|
func spawn():
|
||||||
get_parent().get_parent().spawn(get_tree().get_network_unique_id())
|
get_parent().get_parent().spawn(get_tree().get_network_unique_id())
|
||||||
|
|
|
@ -22,28 +22,21 @@ __meta__ = {
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
|
||||||
margin_left = -177.0
|
margin_left = -177.0
|
||||||
margin_top = -50.0
|
margin_top = -26.0
|
||||||
margin_right = 176.0
|
margin_right = 176.0
|
||||||
margin_bottom = 50.0
|
margin_bottom = 26.0
|
||||||
|
|
||||||
[node name="CharacterList" type="HBoxContainer" parent="CenterContainer/VBoxContainer"]
|
[node name="CharacterList" type="HBoxContainer" parent="CenterContainer/VBoxContainer"]
|
||||||
margin_right = 353.0
|
margin_right = 353.0
|
||||||
margin_bottom = 48.0
|
|
||||||
alignment = 1
|
alignment = 1
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="CenterContainer/VBoxContainer/CharacterList"]
|
|
||||||
margin_left = 30.0
|
|
||||||
margin_right = 322.0
|
|
||||||
margin_bottom = 48.0
|
|
||||||
text = "Her Majesty the Queen"
|
|
||||||
|
|
||||||
[node name="Options" type="HBoxContainer" parent="CenterContainer/VBoxContainer"]
|
[node name="Options" type="HBoxContainer" parent="CenterContainer/VBoxContainer"]
|
||||||
margin_top = 52.0
|
margin_top = 4.0
|
||||||
margin_right = 353.0
|
margin_right = 353.0
|
||||||
margin_bottom = 100.0
|
margin_bottom = 52.0
|
||||||
alignment = 1
|
alignment = 1
|
||||||
|
|
||||||
[node name="SelectButton" type="Button" parent="CenterContainer/VBoxContainer/Options"]
|
[node name="SelectButton" type="Button" parent="CenterContainer/VBoxContainer/Options"]
|
||||||
|
|
|
@ -11,6 +11,7 @@ const WALK_DECEL = 0.1
|
||||||
|
|
||||||
const MOUSE_SENSITIVITY = 1.0 / 1000
|
const MOUSE_SENSITIVITY = 1.0 / 1000
|
||||||
|
|
||||||
|
export var show_healthbar = true
|
||||||
export var max_health = 150
|
export var max_health = 150
|
||||||
onready var health = max_health setget set_health
|
onready var health = max_health setget set_health
|
||||||
|
|
||||||
|
@ -310,7 +311,7 @@ func set_local_player():
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
set_health(150)
|
set_health(max_health)
|
||||||
# disabled the ragdoll collider
|
# disabled the ragdoll collider
|
||||||
#for i in $Player/Gibs.get_children():
|
#for i in $Player/Gibs.get_children():
|
||||||
# i.get_child(1).disabled = true
|
# i.get_child(1).disabled = true
|
||||||
|
@ -318,6 +319,8 @@ func _ready():
|
||||||
#$"Player/Gibs/PlayerGibs _cell /shape0".set_disabled(true)
|
#$"Player/Gibs/PlayerGibs _cell /shape0".set_disabled(true)
|
||||||
|
|
||||||
rset_config("translation", MultiplayerAPI.RPC_MODE_SYNC)
|
rset_config("translation", MultiplayerAPI.RPC_MODE_SYNC)
|
||||||
|
if !show_healthbar:
|
||||||
|
$Billboard.hide()
|
||||||
|
|
||||||
# only show the debug label on local machine
|
# only show the debug label on local machine
|
||||||
if name != String(get_tree().get_network_unique_id()):
|
if name != String(get_tree().get_network_unique_id()):
|
||||||
|
|
Reference in New Issue