diff --git a/AnonymousPro-Regular.ttf b/AnonymousPro-Regular.ttf new file mode 100644 index 0000000..57aa893 Binary files /dev/null and b/AnonymousPro-Regular.ttf differ diff --git a/Creature.gd b/Creature.gd index 94d62a7..1e2776d 100644 --- a/Creature.gd +++ b/Creature.gd @@ -12,6 +12,20 @@ const TRAITS = { } const TIERS_STRING = "12 3 1 23 12 3 4 51 2 3 4 1 " const TRAIT_STRING = "Arm Leg Head Skin Penis" +const SKIN_COLORS = [ + Color("#000000"), + Color("#ff0000"), + Color("#0000ff"), + Color("#ffff00"), + Color("#ffffff"), + Color("#888888"), + Color("#ff0088"), + Color("#ff8800"), + Color("#8800ff"), + Color("#0088ff"), + Color("#880088"), + Color("#333333") +] func initialize(): # Make one boolean per thing we need @@ -29,10 +43,22 @@ func sum(a): sum += a[i] return sum +func range_trait(name): + var start = 0 + var end = 0 + for i in TRAITS: + if i != name: + start += sum(TRAITS[i]) + else: + print(TRAITS[i]) + end = start+sum(TRAITS[i]) + break + return range(start, end) + func describe(): var TRAIT_DESC = "Has a %s trait of tier %d." var LATENT_DESC = " latent tier %d trait." - + var out = "" var d = 0 var found_trait = false for i in range(TRAITS.size()): @@ -40,10 +66,10 @@ func describe(): for j in range(TRAITS.values()[i].size()): for x in range(TRAITS.values()[i][j]): if !found_trait && dna[d]: - print(TRAIT_DESC % [TRAITS.keys()[i], j+1]) + out += TRAIT_DESC % [TRAITS.keys()[i], j+1] + '\n' found_trait = true elif found_trait && dna[d]: - print(LATENT_DESC % [j+1]) + out += LATENT_DESC % [j+1] + '\n' d += 1 var strand = "" for i in range(dna.size()): @@ -51,15 +77,27 @@ func describe(): strand += "1" else: strand += "0" - print(strand) - print(TIERS_STRING) - print(TRAIT_STRING) - get_node("InfoScreen/Viewport/Control/Description").text = (strand) + out += strand + '\n' + out += TIERS_STRING + '\n' + out += TRAIT_STRING + '\n' + return out + +func set_color(): + var j = 0 + var x = 0 + for i in range_trait("Skin"): + if dna[i]: + x = j + break + j += 1 + 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) + print(SKIN_COLORS[x]) func _ready(): initialize() - # print(dna.size()) - describe() #Register the selection event get_node("Area").connect('input_event', get_parent(), 'select_a_bitch', [get_index()]) pass \ No newline at end of file diff --git a/Creature.tscn b/Creature.tscn index 63f708b..253bcb2 100644 --- a/Creature.tscn +++ b/Creature.tscn @@ -1,9 +1,8 @@ -[gd_scene load_steps=12 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://figure.gltf" type="PackedScene" id=1] [ext_resource path="res://Creature.gd" type="Script" id=2] -[ext_resource path="res://InfoScreen.gd" type="Script" id=3] -[ext_resource path="res://Creature.tres" type="Material" id=4] +[ext_resource path="res://Creature.tres" type="Material" id=3] [sub_resource type="CylinderMesh" id=1] top_radius = 0.5 @@ -14,22 +13,10 @@ rings = 2 [sub_resource type="ShaderMaterial" id=2] -[sub_resource type="ViewportTexture" id=3] -viewport_path = NodePath("InfoScreen/Viewport") - -[sub_resource type="SpatialMaterial" id=4] -resource_local_to_scene = true -albedo_texture = SubResource( 3 ) - -[sub_resource type="QuadMesh" id=5] - -[sub_resource type="BoxShape" id=6] -extents = Vector3( 0.51038, 0.447592, 0.128839 ) - -[sub_resource type="CylinderShape" id=9] +[sub_resource type="CylinderShape" id=3] height = 1.21849 -[node name="Creature" index="0" instance=ExtResource( 1 )] +[node name="Creature" instance=ExtResource( 1 )] script = ExtResource( 2 ) [node name="SelectionIndicator" type="MeshInstance" parent="." index="0"] @@ -38,45 +25,11 @@ cast_shadow = 0 mesh = SubResource( 1 ) material/0 = SubResource( 2 ) -[node name="InfoScreen" type="StaticBody" parent="." index="1"] -script = ExtResource( 3 ) - -[node name="Screen" type="MeshInstance" parent="InfoScreen" index="0"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.24649, 0 ) -material_override = SubResource( 4 ) -cast_shadow = 0 -mesh = SubResource( 5 ) -material/0 = null - -[node name="CollisionShape" type="CollisionShape" parent="InfoScreen" index="1"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.23924, 0 ) -shape = SubResource( 6 ) - -[node name="Viewport" type="Viewport" parent="InfoScreen" index="2"] -size = Vector2( 500, 500 ) -hdr = false -disable_3d = true -usage = 0 -render_target_v_flip = true -gui_disable_input = true - -[node name="Control" type="Control" parent="InfoScreen/Viewport" index="0"] -margin_right = 522.0 -margin_bottom = 494.0 - -[node name="Description" type="RichTextLabel" parent="InfoScreen/Viewport/Control" index="0"] -margin_top = -1.0 -margin_right = 102.0 -margin_bottom = 101.0 -rect_scale = Vector2( 5, 5 ) -text = "Hallo ik ben een creature. -aangenaam ofzo" - [node name="Mesh" parent="Node/Node 2/Armature" index="0"] -material/0 = ExtResource( 4 ) +material/0 = ExtResource( 3 ) -[node name="Area" type="Area" parent="." index="4"] +[node name="Area" type="Area" parent="." index="3"] [node name="CollisionShape" type="CollisionShape" parent="Area" index="0"] transform = Transform( 0.25, 0, 0, 0, 1, 0, 0, 0, 0.25, 0, 0.803572, 0 ) -shape = SubResource( 9 ) +shape = SubResource( 3 ) diff --git a/CreatureLab.gd b/CreatureLab.gd index a0f0226..c437222 100644 --- a/CreatureLab.gd +++ b/CreatureLab.gd @@ -13,8 +13,9 @@ func spawn_a_bitch(): add_child(c) # Geef de bitch een random positie en rotatie - c.rotate_y(rand_range(-5, 5)) + #c.rotate_y(rand_range(-5, 5)) c.transform = Transform(c.transform.basis, Vector3(rand_range(-7, 7), 0, rand_range(-5, 5))) + c.set_color() return c func kill_a_bitch(): @@ -36,6 +37,7 @@ func combine_a_bitch(): deselect_all() select(new_child) new_child.describe() + new_child.set_color() func deselect_all(): for i in range(selected.size()): @@ -49,6 +51,17 @@ 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() func select_a_bitch(camera, event, click_position, click_normal, index, creature_id): if event.is_action_pressed("select_creature"): diff --git a/Spatial.tscn b/Spatial.tscn index cf5e0c5..0d7d167 100644 --- a/Spatial.tscn +++ b/Spatial.tscn @@ -1,26 +1,51 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=13 format=2] -[ext_resource path="res://CreatureLab.gd" type="Script" id=1] +[ext_resource path="res://AnonymousPro-Regular.ttf" type="DynamicFontData" id=1] [ext_resource path="res://Creature.tscn" type="PackedScene" id=2] +[ext_resource path="res://CreatureLab.gd" type="Script" id=3] [sub_resource type="CanvasItemMaterial" id=1] +[sub_resource type="DynamicFont" id=7] +font_data = ExtResource( 1 ) + +[sub_resource type="DynamicFont" id=8] +font_data = ExtResource( 1 ) + +[sub_resource type="DynamicFont" id=9] +font_data = ExtResource( 1 ) + [sub_resource type="ProceduralSky" id=2] -radiance_size = 5 -sky_top_color = Color( 0.992157, 1, 0.870588, 1 ) -sky_horizon_color = Color( 0.847059, 0.411765, 0.14902, 1 ) -sky_curve = 0.0783495 -ground_bottom_color = Color( 0.176471, 0.243137, 0.180392, 1 ) -ground_horizon_color = Color( 0.0666667, 0.188235, 0.0431373, 1 ) -ground_curve = 0.196983 -sun_color = Color( 0.717647, 0.431373, 0.176471, 1 ) -sun_latitude = 6.66 -sun_longitude = 22.68 -sun_energy = 6.04 +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] background_mode = 2 background_sky = SubResource( 2 ) + +[sub_resource type="World" id=4] +environment = SubResource( 3 ) + +[sub_resource type="ProceduralSky" id=5] +sky_top_color = Color( 0, 0, 0, 1 ) +sky_horizon_color = Color( 0, 0, 0, 1 ) +sky_curve = 1.44 +sky_energy = 1.77 +ground_bottom_color = Color( 0.168627, 0.203922, 0.172549, 1 ) +ground_horizon_color = Color( 0, 0, 0, 1 ) +ground_curve = 0.16 +sun_color = Color( 0.835294, 0.462745, 0.462745, 1 ) +sun_latitude = 11.29 +sun_energy = 20.16 + +[sub_resource type="Environment" id=6] +background_mode = 2 +background_sky = SubResource( 5 ) background_color = Color( 0.803922, 0.54902, 0.333333, 0.196078 ) tonemap_mode = 2 auto_exposure_speed = 3.15 @@ -33,7 +58,6 @@ dof_blur_far_transition = 3.35 dof_blur_far_amount = 0.13 dof_blur_far_quality = 2 dof_blur_near_distance = 0.07 -glow_enabled = true glow_levels/1 = true glow_levels/5 = false glow_levels/7 = true @@ -45,14 +69,14 @@ glow_bicubic_upscale = true [node name="Todd_Test" type="Spatial"] -[node name="GUI" type="CanvasLayer" parent="."] -editor/display_folded = true - -[node name="Control" type="Control" parent="GUI"] -editor/display_folded = true +[node name="GUI" type="Control" parent="."] material = SubResource( 1 ) +margin_left = 10.0 +margin_top = 10.0 +margin_right = 10.0 +margin_bottom = 10.0 -[node name="Spawn" type="Button" parent="GUI/Control"] +[node name="Spawn" type="Button" parent="GUI"] anchor_top = 1.0 anchor_bottom = 1.0 margin_left = 50.0 @@ -61,7 +85,7 @@ margin_right = 149.0 margin_bottom = 70.0 text = "Spawn a bitch" -[node name="Kill" type="Button" parent="GUI/Control"] +[node name="Kill" type="Button" parent="GUI"] margin_left = 224.723 margin_top = 49.0975 margin_right = 303.723 @@ -69,26 +93,60 @@ margin_bottom = 69.0975 shortcut_in_tooltip = false text = "Kill a bitch" -[node name="Button" type="Button" parent="GUI/Control"] -margin_left = 500.0 -margin_top = 50.0 -margin_right = 73.0 +[node name="Button" type="Button" parent="GUI"] +margin_left = 1778.14 +margin_top = 43.5382 +margin_right = 1851.14 +margin_bottom = 63.5382 text = "Combine!" -[node name="Log" type="Label" parent="GUI"] -anchor_bottom = 1.0 -margin_bottom = -586.0 -align = 1 +[node name="Parent0" type="RichTextLabel" parent="GUI"] +margin_left = -9.0 +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 ) + +[node name="Parent1" type="RichTextLabel" parent="GUI"] +margin_left = 1372.0 +margin_top = 920.0 +margin_right = 1907.0 +margin_bottom = 1070.0 +rect_min_size = Vector2( 100, 100 ) +custom_fonts/normal_font = SubResource( 9 ) + +[node name="Preview0" type="ViewportContainer" parent="GUI"] +margin_left = -7.75415 +margin_top = 657.809 +margin_right = 632.246 +margin_bottom = 1137.81 +rect_scale = Vector2( 0.5, 0.5 ) + +[node name="Viewport" type="Viewport" parent="GUI/Preview0"] +size = Vector2( 640, 480 ) +world = SubResource( 4 ) +handle_input_locally = false +render_target_update_mode = 3 +gui_disable_input = true + +[node name="Camera2" type="Camera" parent="GUI/Preview0/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/Preview0/Viewport" instance=ExtResource( 2 )] +visible = false [node name="Camera" type="Camera" parent="."] -transform = Transform( 1, 0, 0, 0, 0.879275, 0.476315, 0, -0.476315, 0.879275, 0, 10.2303, 14.7057 ) +transform = Transform( 1, 0, 0, 0, 0.931938, 0.362618, 0, -0.362618, 0.931938, 0, 8.78949, 14.7057 ) [node name="CreatureLab" type="Node" parent="."] -script = ExtResource( 1 ) +script = ExtResource( 3 ) Creature = ExtResource( 2 ) [node name="WorldEnvironment" type="WorldEnvironment" parent="."] -environment = SubResource( 3 ) -[connection signal="pressed" from="GUI/Control/Spawn" to="CreatureLab" method="spawn_a_bitch"] -[connection signal="pressed" from="GUI/Control/Kill" to="CreatureLab" method="kill_a_bitch"] -[connection signal="pressed" from="GUI/Control/Button" to="CreatureLab" method="combine_a_bitch"] +environment = SubResource( 6 ) +[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"] diff --git a/project.godot b/project.godot index 8a452d4..216aab7 100644 --- a/project.godot +++ b/project.godot @@ -19,6 +19,14 @@ config/name="Recombinator" run/main_scene="res://Spatial.tscn" config/icon="res://icon.png" +[display] + +window/size/width=1920 +window/size/height=1080 +window/size/resizable=false +window/dpi/allow_hidpi=true +window/stretch/mode="2d" + [input] select_creature={