diff --git a/Creature.gd b/Creature.gd index 557874c..bf21c4b 100644 --- a/Creature.gd +++ b/Creature.gd @@ -106,4 +106,4 @@ func _ready(): initialize() #Register the selection event get_node("Area").connect('input_event', get_parent(), 'select_a_bitch', [get_index()]) - pass \ No newline at end of file + pass diff --git a/Global.gd b/Global.gd new file mode 100644 index 0000000..99886a9 --- /dev/null +++ b/Global.gd @@ -0,0 +1,36 @@ +extends Node + +var current_scene = null + +func _ready(): + var root = get_tree().get_root() + current_scene = root.get_child(root.get_child_count() - 1) + +func goto_scene(path): + # This function will usually be called from a signal callback, + # or some other function in the current scene. + # Deleting the current scene at this point is + # a bad idea, because it may still be executing code. + # This will result in a crash or unexpected behavior. + + # The solution is to defer the load to a later time, when + # we can be sure that no code from the current scene is running: + + call_deferred("_deferred_goto_scene", path) + + +func _deferred_goto_scene(path): + # It is now safe to remove the current scene + current_scene.free() + + # Load the new scene. + var s = ResourceLoader.load(path) + + # Instance the new scene. + current_scene = s.instance() + + # Add it to the active scene, as child of root. + get_tree().get_root().add_child(current_scene) + + # Optionally, to make it compatible with the SceneTree.change_scene() API. + get_tree().set_current_scene(current_scene) diff --git a/Main Menu.gd b/Main Menu.gd new file mode 100644 index 0000000..1bd683e --- /dev/null +++ b/Main Menu.gd @@ -0,0 +1,18 @@ +extends Control + + +func _ready(): + get_node("PanelM/SuperText").hide() + pass # Replace with function body. + + +func _on_SuperButton_pressed(): + get_node("PanelM/SuperText").show() + + +func _on_ExitButton_pressed(): + get_tree().quit() + + +func _on_TestButton_pressed(): + Global.goto_scene("res://Todd_Test.tscn") diff --git a/Main Menu.tscn b/Main Menu.tscn new file mode 100644 index 0000000..34e6195 --- /dev/null +++ b/Main Menu.tscn @@ -0,0 +1,64 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://Menu/iconegg.png" type="Texture" id=1] +[ext_resource path="res://Main Menu.gd" type="Script" id=2] + +[node name="Main Menu" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -35.7413 +margin_top = 63.0057 +margin_right = -35.7412 +margin_bottom = 63.0056 +script = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="PanelM" type="Panel" parent="."] +margin_left = 660.0 +margin_top = 240.0 +margin_right = 1260.0 +margin_bottom = 840.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="TestButton" type="Button" parent="PanelM"] +margin_left = 20.0 +margin_top = 20.0 +margin_right = 580.0 +margin_bottom = 60.0 +text = "Testomgeving" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ExitButton" type="Button" parent="PanelM"] +margin_left = 21.0526 +margin_top = 550.0 +margin_right = 581.053 +margin_bottom = 580.0 +text = "Exit Game" + +[node name="SuperButton" type="Button" parent="PanelM"] +margin_left = 601.67 +margin_top = 584.929 +margin_right = 869.67 +margin_bottom = 846.929 +rect_scale = Vector2( 0.05, 0.05 ) +icon = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="SuperText" type="TextEdit" parent="PanelM"] +visible = false +margin_left = 23.0 +margin_top = 69.0 +margin_right = 577.0 +margin_bottom = 535.0 +text = "Mark houdt van BBC" +[connection signal="pressed" from="PanelM/TestButton" to="." method="_on_TestButton_pressed"] +[connection signal="pressed" from="PanelM/ExitButton" to="." method="_on_ExitButton_pressed"] +[connection signal="pressed" from="PanelM/SuperButton" to="." method="_on_SuperButton_pressed"] diff --git a/Menu/iconegg.png b/Menu/iconegg.png new file mode 100644 index 0000000..d3ba6b7 Binary files /dev/null and b/Menu/iconegg.png differ diff --git a/Menu/iconegg.png.import b/Menu/iconegg.png.import new file mode 100644 index 0000000..f16e74e --- /dev/null +++ b/Menu/iconegg.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/iconegg.png-df04dee929de78e42ccbf1194b49a54d.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Menu/iconegg.png" +dest_files=[ "res://.import/iconegg.png-df04dee929de78e42ccbf1194b49a54d.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Todd_Test.tscn b/Todd_Test.tscn new file mode 100644 index 0000000..be31434 --- /dev/null +++ b/Todd_Test.tscn @@ -0,0 +1,217 @@ +[gd_scene load_steps=17 format=2] + +[ext_resource path="res://UI.png" type="Texture" id=1] +[ext_resource path="res://CreatureLab.gd" type="Script" id=2] +[ext_resource path="res://AnonymousPro-Regular.ttf" type="DynamicFontData" id=3] +[ext_resource path="res://Creature.tscn" type="PackedScene" id=4] + +[sub_resource type="CanvasItemMaterial" id=1] + +[sub_resource type="DynamicFont" id=2] +font_data = ExtResource( 3 ) + +[sub_resource type="Theme" id=3] +default_font = SubResource( 2 ) + +[sub_resource type="Theme" id=4] + +[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_latitude = 132.55 +sun_energy = 14.22 + +[sub_resource type="Environment" id=6] +background_mode = 2 +background_sky = SubResource( 5 ) + +[sub_resource type="World" id=7] +environment = SubResource( 6 ) + +[sub_resource type="ProceduralSky" id=8] +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=9] +background_mode = 2 +background_sky = SubResource( 8 ) + +[sub_resource type="World" id=10] +environment = SubResource( 9 ) + +[sub_resource type="ProceduralSky" id=11] +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=12] +background_mode = 2 +background_sky = SubResource( 11 ) +background_color = Color( 0.803922, 0.54902, 0.333333, 0.196078 ) +tonemap_mode = 2 +auto_exposure_speed = 3.15 +ssao_enabled = true +ssao_quality = 2 +ssao_blur = 2 +ssao_edge_sharpness = 11.5 +dof_blur_far_distance = 114.9 +dof_blur_far_transition = 3.35 +dof_blur_far_amount = 0.13 +dof_blur_far_quality = 2 +dof_blur_near_distance = 0.07 +glow_levels/1 = true +glow_levels/5 = false +glow_levels/7 = true +glow_strength = 0.94 +glow_blend_mode = 1 +glow_hdr_luminance_cap = 105.57 +glow_hdr_scale = 2.1 +glow_bicubic_upscale = true + +[node name="Todd_Test" type="Spatial"] + +[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 +theme = SubResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Spawn" type="Button" parent="GUI"] +anchor_top = 1.0 +anchor_bottom = 1.0 +margin_left = 50.0 +margin_top = 50.0 +margin_right = 185.0 +margin_bottom = 70.0 +text = "Spawn a bitch" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Kill" type="Button" parent="GUI"] +margin_left = 1750.0 +margin_top = 50.0 +margin_right = 1873.0 +margin_bottom = 70.0 +shortcut_in_tooltip = false +text = "Kill a bitch" + +[node name="Button" type="Button" parent="GUI"] +margin_left = 860.26 +margin_top = 980.795 +margin_right = 1028.26 +margin_bottom = 1042.8 +theme = SubResource( 4 ) +text = "Combine!" + +[node name="Parent0" type="RichTextLabel" parent="GUI"] +margin_top = 910.0 +margin_right = 450.0 +margin_bottom = 1060.0 +rect_min_size = Vector2( 100, 100 ) +text = "Dit is een voorbeeldtekst. +Om te kijken hoe het er uit ziet in de GUI. +Dit is een voorbeeldtekst. +Om te kijken hoe het er uit ziet in de GUI. +Dit is een voorbeeldtekst. +Om te kijken hoe het er uit ziet in de GUI. +" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Parent1" type="RichTextLabel" parent="GUI"] +margin_left = 1450.0 +margin_top = 910.0 +margin_right = 1900.0 +margin_bottom = 1060.0 +rect_min_size = Vector2( 100, 100 ) +text = "Dit is een voorbeeldtekst. +Om te kijken hoe het er uit ziet in de GUI. +Dit is een voorbeeldtekst. +Om te kijken hoe het er uit ziet in de GUI. +Dit is een voorbeeldtekst. +Om te kijken hoe het er uit ziet in de GUI." +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Preview0" type="ViewportContainer" parent="GUI"] +margin_top = 660.0 +margin_right = 640.0 +margin_bottom = 1140.0 +rect_scale = Vector2( 0.5, 0.5 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Viewport" type="Viewport" parent="GUI/Preview0"] +size = Vector2( 640, 480 ) +world = SubResource( 7 ) +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="Preview1" type="ViewportContainer" parent="GUI"] +margin_left = 1580.0 +margin_top = 660.0 +margin_right = 2220.0 +margin_bottom = 1140.0 +rect_scale = Vector2( 0.5, 0.5 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Viewport" type="Viewport" parent="GUI/Preview1"] +size = Vector2( 640, 480 ) +world = SubResource( 10 ) +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="UI" type="Sprite" parent="GUI"] +show_behind_parent = true +light_mask = 2 +position = Vector2( -10, -10 ) +scale = Vector2( 0.5, 0.5 ) +texture = ExtResource( 1 ) +centered = 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 ) + +[node name="CreatureLab" type="Node" parent="."] +script = ExtResource( 2 ) +Creature = ExtResource( 4 ) + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource( 12 ) +[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 6297fb8..b787c32 100644 --- a/project.godot +++ b/project.godot @@ -16,9 +16,13 @@ _global_script_class_icons={ [application] config/name="Recombinator" -run/main_scene="res://Spatial.tscn" +run/main_scene="res://Main Menu.tscn" config/icon="res://icon.png" +[autoload] + +Global="*res://Global.gd" + [display] window/size/width=1920