Previews fixed
This commit is contained in:
+7
-1
@@ -27,6 +27,10 @@ const SKIN_COLORS = [
|
||||
Color("#333333")
|
||||
]
|
||||
|
||||
var SKIN_MATERIALS = [
|
||||
SpatialMaterial.new()
|
||||
]
|
||||
|
||||
func initialize():
|
||||
# Make one boolean per thing we need
|
||||
for i in range(TRAITS.size()):
|
||||
@@ -93,7 +97,9 @@ func set_color():
|
||||
var mesh = get_node("Node/Node 2/Armature/Mesh")
|
||||
var mat = mesh.get_surface_material(0).duplicate()
|
||||
mat.albedo_color = SKIN_COLORS[x]
|
||||
mesh.set_surface_material(0, mat)
|
||||
# mesh.set_surface_material(0, mat)
|
||||
SKIN_MATERIALS[0].albedo_color = SKIN_COLORS[x]
|
||||
mesh.set_surface_material(0, SKIN_MATERIALS[0])
|
||||
print(SKIN_COLORS[x])
|
||||
|
||||
func _ready():
|
||||
|
||||
+27
-12
@@ -14,7 +14,7 @@ func spawn_a_bitch():
|
||||
|
||||
# Geef de bitch een random positie en rotatie
|
||||
#c.rotate_y(rand_range(-5, 5))
|
||||
c.transform = Transform(c.transform.basis, Vector3(rand_range(-7, 7), 0, rand_range(-5, 5)))
|
||||
c.transform = Transform(c.transform.basis, Vector3(rand_range(-17, 17), 0, rand_range(-30, 0)))
|
||||
c.set_color()
|
||||
return c
|
||||
|
||||
@@ -39,10 +39,35 @@ func combine_a_bitch():
|
||||
new_child.describe()
|
||||
new_child.set_color()
|
||||
|
||||
func select_changed_hook():
|
||||
var p0 = get_node("../GUI/Parent0")
|
||||
var p1 = get_node("../GUI/Parent1")
|
||||
p0.text = ""
|
||||
p1.text = ""
|
||||
var preview0 = get_node("../GUI/Preview0/Viewport")
|
||||
var preview1 = get_node("../GUI/Preview1/Viewport")
|
||||
for i in range(1, preview0.get_child_count()):
|
||||
preview0.remove_child(preview0.get_child(i))
|
||||
for i in range(1, preview1.get_child_count()):
|
||||
preview1.remove_child(preview1.get_child(i))
|
||||
if selected.size() >= 1:
|
||||
p0.text = selected[0].describe()
|
||||
var copy0 = selected[0].duplicate()
|
||||
copy0.get_node("AnimationPlayer").set_autoplay("Animation")
|
||||
copy0.transform = Transform(copy0.transform.basis, Vector3(0, 0, 0))
|
||||
preview0.add_child(copy0)
|
||||
if selected.size() >= 2:
|
||||
p1.text = selected[1].describe()
|
||||
var copy1 = selected[1].duplicate()
|
||||
copy1.get_node("AnimationPlayer").set_autoplay("Animation")
|
||||
copy1.transform = Transform(copy1.transform.basis, Vector3(0, 0, 0))
|
||||
preview1.add_child(copy1)
|
||||
|
||||
func deselect_all():
|
||||
for i in range(selected.size()):
|
||||
selected[i].get_node("SelectionIndicator").visible = false;
|
||||
selected = []
|
||||
select_changed_hook()
|
||||
|
||||
func select(creature):
|
||||
if selected.has(creature):
|
||||
@@ -51,17 +76,7 @@ func select(creature):
|
||||
else:
|
||||
selected.append(creature)
|
||||
creature.get_node("SelectionIndicator").visible = true;
|
||||
var p0 = get_node("../GUI/Parent0")
|
||||
var p1 = get_node("../GUI/Parent1")
|
||||
p0.text = ""
|
||||
p1.text = ""
|
||||
if selected.size() >= 1:
|
||||
p0.text = selected[0].describe()
|
||||
var copy0 = selected[0].duplicate()
|
||||
copy0.get_node("AnimationPlayer").set_autoplay("Animation")
|
||||
get_node("../GUI/Preview0/Viewport").add_child(copy0)
|
||||
if selected.size() >= 2:
|
||||
p1.text = selected[1].describe()
|
||||
select_changed_hook()
|
||||
|
||||
func select_a_bitch(camera, event, click_position, click_normal, index, creature_id):
|
||||
if event.is_action_pressed("select_creature"):
|
||||
|
||||
+53
-18
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=13 format=2]
|
||||
[gd_scene load_steps=16 format=2]
|
||||
|
||||
[ext_resource path="res://AnonymousPro-Regular.ttf" type="DynamicFontData" id=1]
|
||||
[ext_resource path="res://Creature.tscn" type="PackedScene" id=2]
|
||||
@@ -6,32 +6,46 @@
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id=1]
|
||||
|
||||
[sub_resource type="DynamicFont" id=7]
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=8]
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=9]
|
||||
[sub_resource type="DynamicFont" id=4]
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="ProceduralSky" id=2]
|
||||
[sub_resource type="ProceduralSky" id=5]
|
||||
sky_top_color = Color( 0, 0, 0, 1 )
|
||||
sky_horizon_color = Color( 0, 0, 0, 1 )
|
||||
ground_bottom_color = Color( 0, 0, 0, 1 )
|
||||
ground_horizon_color = Color( 0, 0, 0, 1 )
|
||||
sun_color = Color( 0.482353, 0.905882, 0.945098, 1 )
|
||||
sun_latitude = 132.55
|
||||
sun_energy = 14.22
|
||||
|
||||
[sub_resource type="Environment" id=3]
|
||||
[sub_resource type="Environment" id=6]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 2 )
|
||||
background_sky = SubResource( 5 )
|
||||
|
||||
[sub_resource type="World" id=4]
|
||||
environment = SubResource( 3 )
|
||||
[sub_resource type="World" id=7]
|
||||
environment = SubResource( 6 )
|
||||
|
||||
[sub_resource type="ProceduralSky" id=5]
|
||||
[sub_resource type="ProceduralSky" id=10]
|
||||
sky_top_color = Color( 0, 0, 0, 1 )
|
||||
sky_horizon_color = Color( 0, 0, 0, 1 )
|
||||
ground_bottom_color = Color( 0, 0, 0, 1 )
|
||||
ground_horizon_color = Color( 0, 0, 0, 1 )
|
||||
sun_latitude = 137.19
|
||||
sun_energy = 14.21
|
||||
|
||||
[sub_resource type="Environment" id=11]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 10 )
|
||||
|
||||
[sub_resource type="World" id=12]
|
||||
environment = SubResource( 11 )
|
||||
|
||||
[sub_resource type="ProceduralSky" id=8]
|
||||
sky_top_color = Color( 0, 0, 0, 1 )
|
||||
sky_horizon_color = Color( 0, 0, 0, 1 )
|
||||
sky_curve = 1.44
|
||||
@@ -43,9 +57,9 @@ sun_color = Color( 0.835294, 0.462745, 0.462745, 1 )
|
||||
sun_latitude = 11.29
|
||||
sun_energy = 20.16
|
||||
|
||||
[sub_resource type="Environment" id=6]
|
||||
[sub_resource type="Environment" id=9]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 5 )
|
||||
background_sky = SubResource( 8 )
|
||||
background_color = Color( 0.803922, 0.54902, 0.333333, 0.196078 )
|
||||
tonemap_mode = 2
|
||||
auto_exposure_speed = 3.15
|
||||
@@ -106,8 +120,8 @@ margin_top = 916.0
|
||||
margin_right = 447.0
|
||||
margin_bottom = 1066.0
|
||||
rect_min_size = Vector2( 100, 100 )
|
||||
custom_fonts/mono_font = SubResource( 7 )
|
||||
custom_fonts/normal_font = SubResource( 8 )
|
||||
custom_fonts/mono_font = SubResource( 2 )
|
||||
custom_fonts/normal_font = SubResource( 3 )
|
||||
|
||||
[node name="Parent1" type="RichTextLabel" parent="GUI"]
|
||||
margin_left = 1372.0
|
||||
@@ -115,7 +129,7 @@ margin_top = 920.0
|
||||
margin_right = 1907.0
|
||||
margin_bottom = 1070.0
|
||||
rect_min_size = Vector2( 100, 100 )
|
||||
custom_fonts/normal_font = SubResource( 9 )
|
||||
custom_fonts/normal_font = SubResource( 4 )
|
||||
|
||||
[node name="Preview0" type="ViewportContainer" parent="GUI"]
|
||||
margin_left = -7.75415
|
||||
@@ -126,7 +140,7 @@ rect_scale = Vector2( 0.5, 0.5 )
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="GUI/Preview0"]
|
||||
size = Vector2( 640, 480 )
|
||||
world = SubResource( 4 )
|
||||
world = SubResource( 7 )
|
||||
handle_input_locally = false
|
||||
render_target_update_mode = 3
|
||||
gui_disable_input = true
|
||||
@@ -138,6 +152,27 @@ current = true
|
||||
[node name="Creature" parent="GUI/Preview0/Viewport" instance=ExtResource( 2 )]
|
||||
visible = false
|
||||
|
||||
[node name="Preview1" type="ViewportContainer" parent="GUI"]
|
||||
margin_left = 1590.76
|
||||
margin_top = 645.532
|
||||
margin_right = 2230.76
|
||||
margin_bottom = 1125.53
|
||||
rect_scale = Vector2( 0.5, 0.5 )
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="GUI/Preview1"]
|
||||
size = Vector2( 640, 480 )
|
||||
world = SubResource( 12 )
|
||||
handle_input_locally = false
|
||||
render_target_update_mode = 3
|
||||
gui_disable_input = true
|
||||
|
||||
[node name="Camera2" type="Camera" parent="GUI/Preview1/Viewport"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0237979, 0.798024, 1.44028 )
|
||||
current = true
|
||||
|
||||
[node name="Creature" parent="GUI/Preview1/Viewport" instance=ExtResource( 2 )]
|
||||
visible = false
|
||||
|
||||
[node name="Camera" type="Camera" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 0.931938, 0.362618, 0, -0.362618, 0.931938, 0, 8.78949, 14.7057 )
|
||||
|
||||
@@ -146,7 +181,7 @@ script = ExtResource( 3 )
|
||||
Creature = ExtResource( 2 )
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource( 6 )
|
||||
environment = SubResource( 9 )
|
||||
[connection signal="pressed" from="GUI/Spawn" to="CreatureLab" method="spawn_a_bitch"]
|
||||
[connection signal="pressed" from="GUI/Kill" to="CreatureLab" method="kill_a_bitch"]
|
||||
[connection signal="pressed" from="GUI/Button" to="CreatureLab" method="combine_a_bitch"]
|
||||
|
||||
Reference in New Issue
Block a user