From 04a7806aafe210aeefcd80f74d78c8d4420c54e2 Mon Sep 17 00:00:00 2001 From: J08nY Date: Sun, 23 Apr 2017 02:11:28 +0200 Subject: Thats it for tonight, got some good work in, lets see what tomorrow brings --- ...x.png-d83549d58cc0df98891261e5a7599858.etc.stex | Bin 0 -> 2748 bytes ....png-d83549d58cc0df98891261e5a7599858.s3tc.stex | Bin 0 -> 2748 bytes ...y_tex.png-d83549d58cc0df98891261e5a7599858.stex | Bin 0 -> 148 bytes ...minus.png-4762f967f2398859383593e0213c863b.stex | Bin 0 -> 138 bytes .../plus.png-4edcf3a95e8f281c366463cbe7a974c3.stex | Bin 0 -> 179 bytes assets/gray_tex.aseprite | Bin 0 -> 1469 bytes assets/gray_tex.png | Bin 0 -> 804 bytes assets/gray_tex.png.import | 20 ++ assets/minus.aseprite | Bin 0 -> 999 bytes assets/minus.png | Bin 0 -> 106 bytes assets/minus.png.import | 20 ++ assets/plus.aseprite | Bin 0 -> 1029 bytes assets/plus.png | Bin 0 -> 147 bytes assets/plus.png.import | 20 ++ assets/shop.json | 81 +++++++ base.tscn | 16 +- combinator.tscn | 62 ++++-- combinator_panel.tscn | 57 +++-- gray_mat.tres | 39 ++++ hud.tscn | 242 +++++++++++++++++++++ incubator.tscn | 65 +++++- ld38.godot | 4 +- player.tscn | 9 + scripts/base.gd | 16 +- scripts/camera.gd | 12 +- scripts/combinator_panel.gd | 14 ++ scripts/hud.gd | 16 ++ scripts/multiverse_shop.gd | 53 +++++ scripts/player.gd | 17 ++ scripts/world.gd | 4 +- world.tscn | 14 +- 31 files changed, 722 insertions(+), 59 deletions(-) create mode 100644 .import/gray_tex.png-d83549d58cc0df98891261e5a7599858.etc.stex create mode 100644 .import/gray_tex.png-d83549d58cc0df98891261e5a7599858.s3tc.stex create mode 100644 .import/gray_tex.png-d83549d58cc0df98891261e5a7599858.stex create mode 100644 .import/minus.png-4762f967f2398859383593e0213c863b.stex create mode 100644 .import/plus.png-4edcf3a95e8f281c366463cbe7a974c3.stex create mode 100644 assets/gray_tex.aseprite create mode 100644 assets/gray_tex.png create mode 100644 assets/gray_tex.png.import create mode 100644 assets/minus.aseprite create mode 100644 assets/minus.png create mode 100644 assets/minus.png.import create mode 100644 assets/plus.aseprite create mode 100644 assets/plus.png create mode 100644 assets/plus.png.import create mode 100644 assets/shop.json create mode 100644 gray_mat.tres create mode 100644 hud.tscn create mode 100644 player.tscn create mode 100644 scripts/combinator_panel.gd create mode 100644 scripts/hud.gd create mode 100644 scripts/multiverse_shop.gd create mode 100644 scripts/player.gd diff --git a/.import/gray_tex.png-d83549d58cc0df98891261e5a7599858.etc.stex b/.import/gray_tex.png-d83549d58cc0df98891261e5a7599858.etc.stex new file mode 100644 index 0000000..f26518f Binary files /dev/null and b/.import/gray_tex.png-d83549d58cc0df98891261e5a7599858.etc.stex differ diff --git a/.import/gray_tex.png-d83549d58cc0df98891261e5a7599858.s3tc.stex b/.import/gray_tex.png-d83549d58cc0df98891261e5a7599858.s3tc.stex new file mode 100644 index 0000000..60cc6d4 Binary files /dev/null and b/.import/gray_tex.png-d83549d58cc0df98891261e5a7599858.s3tc.stex differ diff --git a/.import/gray_tex.png-d83549d58cc0df98891261e5a7599858.stex b/.import/gray_tex.png-d83549d58cc0df98891261e5a7599858.stex new file mode 100644 index 0000000..af818e7 Binary files /dev/null and b/.import/gray_tex.png-d83549d58cc0df98891261e5a7599858.stex differ diff --git a/.import/minus.png-4762f967f2398859383593e0213c863b.stex b/.import/minus.png-4762f967f2398859383593e0213c863b.stex new file mode 100644 index 0000000..a1babc2 Binary files /dev/null and b/.import/minus.png-4762f967f2398859383593e0213c863b.stex differ diff --git a/.import/plus.png-4edcf3a95e8f281c366463cbe7a974c3.stex b/.import/plus.png-4edcf3a95e8f281c366463cbe7a974c3.stex new file mode 100644 index 0000000..69f955c Binary files /dev/null and b/.import/plus.png-4edcf3a95e8f281c366463cbe7a974c3.stex differ diff --git a/assets/gray_tex.aseprite b/assets/gray_tex.aseprite new file mode 100644 index 0000000..4c329ee Binary files /dev/null and b/assets/gray_tex.aseprite differ diff --git a/assets/gray_tex.png b/assets/gray_tex.png new file mode 100644 index 0000000..084a929 Binary files /dev/null and b/assets/gray_tex.png differ diff --git a/assets/gray_tex.png.import b/assets/gray_tex.png.import new file mode 100644 index 0000000..0660be9 --- /dev/null +++ b/assets/gray_tex.png.import @@ -0,0 +1,20 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/gray_tex.png-d83549d58cc0df98891261e5a7599858.stex" + +[params] + +compress/mode=1 +compress/lossy_quality=0.7 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=1 +process/fix_alpha_border=true +process/premult_alpha=true +stream=false +size_limit=0 +detect_3d=false diff --git a/assets/minus.aseprite b/assets/minus.aseprite new file mode 100644 index 0000000..5725edd Binary files /dev/null and b/assets/minus.aseprite differ diff --git a/assets/minus.png b/assets/minus.png new file mode 100644 index 0000000..321e2b4 Binary files /dev/null and b/assets/minus.png differ diff --git a/assets/minus.png.import b/assets/minus.png.import new file mode 100644 index 0000000..fb3f760 --- /dev/null +++ b/assets/minus.png.import @@ -0,0 +1,20 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/minus.png-4762f967f2398859383593e0213c863b.stex" + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=true +stream=false +size_limit=0 +detect_3d=true diff --git a/assets/plus.aseprite b/assets/plus.aseprite new file mode 100644 index 0000000..0bd4caf Binary files /dev/null and b/assets/plus.aseprite differ diff --git a/assets/plus.png b/assets/plus.png new file mode 100644 index 0000000..513d0d6 Binary files /dev/null and b/assets/plus.png differ diff --git a/assets/plus.png.import b/assets/plus.png.import new file mode 100644 index 0000000..a5afd20 --- /dev/null +++ b/assets/plus.png.import @@ -0,0 +1,20 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/plus.png-4edcf3a95e8f281c366463cbe7a974c3.stex" + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=true +stream=false +size_limit=0 +detect_3d=true diff --git a/assets/shop.json b/assets/shop.json new file mode 100644 index 0000000..f7c2d83 --- /dev/null +++ b/assets/shop.json @@ -0,0 +1,81 @@ +{ + "1": [ + {"id": "low_planet_mat", + "name": "Low-grade planetary material", + "desc": "Buying this, you basically get bread crumbs from other recycled worlds.", + "cost": 10}, + {"id": "mid_planet_mat", + "name": "Middle-grade planetary material", + "desc": "While still recycled, it's previous owners didn't filter out all the good stuff.", + "cost": 30}, + {"id": "high_planet_mat", + "name": "High-grade planetary material", + "desc": "Made from worlds demolished to make way for a new hyperspatial express drive.", + "cost": 50}, + {"id": "top_planet_mat", + "name": "Pristine planetary material", + "desc": "Pretty much the only source of such high-quality planetary material comes from the underground. ", + "cost": 100}, + {"id": "low_inter_dust", + "name": "Low-grade interplanetary dust", + "desc": "Scraped of the bottom of some junkyard universe megaship, this really doesn't have much to offer.", + "cost": 20}, + {"id": "middle_inter_dust", + "name": "Middle-grade interplanetary dust", + "desc": "", + "cost": 40}, + {"id": "high_inter_dust", + "name": "High-grade interplanetary dust", + "desc": "Collected after a supernova, it contains many diverse elements.", + "cost": 80} + ], + "2": [ + {"id": "unknown_molecules", + "name": "Unknown molecules", + "desc": "The packaging looks leaky and the guarantee signs are all weird but you might take it for the price.", + "cost": 100}, + {"id": "simple_amino", + "name": "Simple aminoacids", + "desc": "", + "cost": 200}, + {"id": "nucleotid", + "name": "Nucleotids", + "desc": "Bunch of nucleotids will step up your life game. These are building blocks of nucleic acids.", + "cost": 300}, + {"id": "nucleic_acid", + "name": "Nucleic acids", + "desc": "", + "cost": 400}, + {"id": "nanotech_elements", + "name": "Nano-tech microelements", + "desc": "", + "cost": 500} + ], + "3": [ + {"id": "chon_life_1", + "name": "CHON based life (level 1)", + "desc": "", + "cost": 1000}, + {"id": "chon_life_2", + "name": "CHON based life (level 2)", + "desc": "", + "cost": 1500}, + {"id": "grey_goo", + "name": "Grey goo", + "desc": "No one really told you what it is, they just sell it.", + "cost": 2000}, + {"id": "cardboard_box", + "name": "A cardboard box", + "desc": "You might have heard some cat noises from the inside, although you can't be sure unless you open it.", + "cost": 3000} + ], + "other": [ + {"id": "planets_howto", + "name": "How it's Made: Planets", + "desc": "The ultimate guide for any beginner but also experienced planet builder!\ + Covers all the bases, even the orthonormal ones.", + "cost": 5} + ] +} + + diff --git a/base.tscn b/base.tscn index 76b3a5a..4b53780 100644 --- a/base.tscn +++ b/base.tscn @@ -1,10 +1,12 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://scripts/base.gd" type="Script" id=1] [ext_resource path="res://scripts/camera.gd" type="Script" id=2] [ext_resource path="res://world.tscn" type="PackedScene" id=3] [ext_resource path="res://incubator.tscn" type="PackedScene" id=4] [ext_resource path="res://combinator.tscn" type="PackedScene" id=5] +[ext_resource path="res://hud.tscn" type="PackedScene" id=6] +[ext_resource path="res://player.tscn" type="PackedScene" id=7] [node name="Game" type="Spatial"] @@ -25,7 +27,7 @@ h_offset = 0.0 v_offset = 0.0 target = NodePath("") speed = 1.0 -enabled = true +enabled = false script = ExtResource( 2 ) [node name="OmniLight" type="OmniLight" parent="Camera"] @@ -33,7 +35,7 @@ script = ExtResource( 2 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2.11108 ) layers = 1 light_color = Color( 1, 1, 1, 1 ) -light_energy = 1.0 +light_energy = 2.0 light_negative = false light_specular = 0.5 light_cull_mask = -1 @@ -64,9 +66,11 @@ transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, - transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 0 ) +[node name="center" type="Position3D" parent="."] + [node name="overview" type="Camera" parent="."] -transform = Transform( 1, 0, 0, 0, 0.771128, 0.63668, 0, -0.63668, 0.771128, 0, 4.08988, 3.34826 ) +transform = Transform( 1, 0, 0, 0, 0.73815, 0.674637, 0, -0.674637, 0.73815, -0.0103998, 4.22607, 2.71686 ) projection = 0 fov = 60.0 near = 0.1 @@ -78,6 +82,8 @@ environment = null h_offset = 0.0 v_offset = 0.0 -[node name="center" type="Position3D" parent="."] +[node name="HUD" parent="." instance=ExtResource( 6 )] + +[node name="Player" parent="." instance=ExtResource( 7 )] diff --git a/combinator.tscn b/combinator.tscn index 72d4c86..15bd457 100644 --- a/combinator.tscn +++ b/combinator.tscn @@ -1,14 +1,15 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://mesh/combinator.dae" type="PackedScene" id=1] [ext_resource path="res://scripts/combinator.gd" type="Script" id=2] -[ext_resource path="res://combinator_panel.tscn" type="PackedScene" id=3] +[ext_resource path="res://gray_mat.tres" type="Material" id=3] +[ext_resource path="res://combinator_panel.tscn" type="PackedScene" id=4] -[sub_resource type="ConvexPolygonShape" id=4] +[sub_resource type="ConvexPolygonShape" id=1] points = PoolVector3Array( 1, -1, -0.999512, 1, -1, 1, -1, -1, 0.999512, -0.999512, -1, -1, 1, 1, -0.999512, -0.999512, 1, -1, -1, 1, 0.999512, 0.999512, 1, 1, 1, -1, -0.999512, 1, 1, -0.999512, 0.999512, 1, 1, 1, -1, 1, 1, -1, 1, 0.999512, 1, 1, -1, 1, 0.999512, -1, -1, 0.999512, -1, -1, 0.999512, -1, 1, 0.999512, -0.999512, 1, -1, -0.999512, -1, -1, 1, 1, -0.999512, 1, -1, -0.999512, -0.999512, -1, -1, -0.999512, 1, -1 ) -[sub_resource type="ConvexPolygonShape" id=5] +[sub_resource type="ConvexPolygonShape" id=2] points = PoolVector3Array( -1, -1, 1.46973, -1, 1, 1.46973, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1.46973, 1, -1, 1.46973, 1, -1, 1.46973, 1, 1, 1.46973, -1, 1, 1.46973, -1, -1, 1.46973, -1, -1, -1, 1, -1, -1, 1, -1, 1.46973, -1, -1, 1.46973, 1, 1, -1, -1, 1, -1, -1, 1, 1.46973, 1, 1, 1.46973 ) @@ -16,7 +17,7 @@ points = PoolVector3Array( -1, -1, 1.46973, -1, 1, 1.46973, -1, 1, -1, -1, -1, - extents = Vector3( 1, 1, 1 ) -[sub_resource type="SpatialMaterial" id=2] +[sub_resource type="SpatialMaterial" id=4] flags_transparent = false flags_unshaded = true @@ -56,12 +57,16 @@ uv2_offset = Vector2( 0, 0 ) script = ExtResource( 2 ) +[node name="Cube" parent="."] + +material_override = ExtResource( 3 ) + [node name="StaticBody" type="StaticBody" parent="Cube"] input_ray_pickable = true input_capture_on_drag = false shape_count = 1 -shapes/0/shape = SubResource( 4 ) +shapes/0/shape = SubResource( 1 ) shapes/0/transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) shapes/0/trigger = true collision_layer = 1 @@ -73,16 +78,20 @@ constant_angular_velocity = Vector3( 0, 0, 0 ) [node name="CollisionShape" type="CollisionShape" parent="Cube/StaticBody"] -shape = SubResource( 4 ) +shape = SubResource( 1 ) trigger = true _update_shape_index = 0 +[node name="Cube.1" parent="."] + +material_override = ExtResource( 3 ) + [node name="StaticBody" type="StaticBody" parent="Cube.1"] input_ray_pickable = true input_capture_on_drag = false shape_count = 1 -shapes/0/shape = SubResource( 5 ) +shapes/0/shape = SubResource( 2 ) shapes/0/transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) shapes/0/trigger = true collision_layer = 1 @@ -94,11 +103,18 @@ constant_angular_velocity = Vector3( 0, 0, 0 ) [node name="CollisionShape" type="CollisionShape" parent="Cube.1/StaticBody"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) -shape = SubResource( 5 ) +shape = SubResource( 2 ) trigger = true _update_shape_index = 0 +[node name="Cube.2" parent="."] + +material_override = ExtResource( 3 ) + +[node name="Cylinder.1" parent="."] + +material_override = ExtResource( 3 ) + [node name="Viewport" type="Viewport" parent="."] size = Vector2( 400, 400 ) @@ -121,7 +137,7 @@ shadow_atlas_quad_1 = 2 shadow_atlas_quad_2 = 3 shadow_atlas_quad_3 = 4 -[node name="CombinatorPanel" parent="Viewport" instance=ExtResource( 3 )] +[node name="CombinatorPanel" parent="Viewport" instance=ExtResource( 4 )] [node name="Area" type="Area" parent="."] @@ -149,7 +165,7 @@ collision_mask = 1 transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0.955984, 0 ) layers = 1 -material_override = SubResource( 2 ) +material_override = SubResource( 4 ) cast_shadow = 1 extra_cull_margin = 0.0 visible_in_all_rooms = false @@ -175,7 +191,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.809103, 1.6303, -1.32872 ) [node name="point" type="Camera" parent="."] -transform = Transform( -3.09086e-08, -0.707107, 0.707107, -1.28028e-08, 0.707107, 0.707107, -1, 1.28028e-08, -3.09086e-08, 2.2, 3, 0 ) +transform = Transform( -3.09086e-08, -0.707107, 0.707107, -1.28028e-08, 0.707107, 0.707107, -1, 1.28028e-08, -3.09086e-08, 2.2, 3.5, 0 ) projection = 0 fov = 60.0 near = 0.1 @@ -187,6 +203,26 @@ environment = null h_offset = 0.0 v_offset = 0.0 +[node name="OmniLight" type="OmniLight" parent="."] + +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1.17673, 2.26107, 1.77229 ) +layers = 1 +light_color = Color( 1, 1, 1, 1 ) +light_energy = 4.0 +light_negative = false +light_specular = 0.1 +light_cull_mask = -1 +shadow_enabled = true +shadow_color = Color( 0, 0, 0, 1 ) +shadow_bias = 0.1 +shadow_contact = 0.0 +shadow_max_distance = 0.0 +editor_only = false +omni_range = 5.0 +omni_attenuation = 1.0 +omni_shadow_mode = 0 +omni_shadow_detail = 1 + [connection signal="input_event" from="Cube/StaticBody" to="." method="_on_body_input_event"] [connection signal="input_event" from="Cube.1/StaticBody" to="." method="_on_panel_input_event"] diff --git a/combinator_panel.tscn b/combinator_panel.tscn index b306f7b..0ea5aa0 100644 --- a/combinator_panel.tscn +++ b/combinator_panel.tscn @@ -1,4 +1,8 @@ -[gd_scene format=2] +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://scripts/combinator_panel.gd" type="Script" id=1] +[ext_resource path="res://assets/plus.png" type="Texture" id=2] +[ext_resource path="res://assets/minus.png" type="Texture" id=3] [node name="CombinatorPanel" type="Panel"] @@ -6,33 +10,48 @@ margin_right = 400.0 margin_bottom = 400.0 rect_clip_content = false mouse_filter = 0 +script = ExtResource( 1 ) + +[node name="Tree" type="Tree" parent="."] + +margin_left = 10.0 +margin_top = 10.0 +margin_right = 340.0 +margin_bottom = 390.0 +mouse_filter = 0 -[node name="Label" type="Label" parent="."] +[node name="add" type="Button" parent="."] -margin_left = 30.0 -margin_top = 40.0 -margin_right = 70.0 -margin_bottom = 54.0 +margin_left = 350.0 +margin_top = 210.0 +margin_right = 394.0 +margin_bottom = 290.0 rect_clip_content = false -mouse_filter = 2 -size_flags_vertical = 0 -text = "Test?" -percent_visible = 1.0 -lines_skipped = 0 -max_lines_visible = -1 - -[node name="Button" type="Button" parent="."] - -margin_left = 120.0 -margin_top = 50.0 -margin_right = 262.0 -margin_bottom = 150.0 +mouse_filter = 0 +toggle_mode = false +enabled_focus_mode = 2 +shortcut = null +group = null +icon = ExtResource( 2 ) +flat = false + +[node name="remove" type="Button" parent="."] + +margin_left = 350.0 +margin_top = 310.0 +margin_right = 394.0 +margin_bottom = 390.0 rect_clip_content = false mouse_filter = 0 toggle_mode = false enabled_focus_mode = 2 shortcut = null group = null +icon = ExtResource( 3 ) flat = false +[connection signal="gui_input" from="Tree" to="." method="_on_Tree_gui_input"] + +[connection signal="mouse_entered" from="Tree" to="." method="_on_Tree_mouse_entered"] + diff --git a/gray_mat.tres b/gray_mat.tres new file mode 100644 index 0000000..fcdb8fd --- /dev/null +++ b/gray_mat.tres @@ -0,0 +1,39 @@ +[gd_resource type="SpatialMaterial" format=2] + +[resource] + +resource_name = "gray_mat" +flags_transparent = false +flags_unshaded = false +flags_on_top = false +flags_use_point_size = false +flags_fixed_size = false +vertex_color_use_as_albedo = false +vertex_color_is_srgb = false +params_diffuse_mode = 0 +params_blend_mode = 0 +params_cull_mode = 0 +params_depth_draw_mode = 0 +params_line_width = 1.0 +params_point_size = 1.0 +params_billboard_mode = 0 +albedo_color = Color( 0.196078, 0.196078, 0.196078, 1 ) +specular_mode = 0 +specular_color = Color( 0.0736863, 0, 0.0736863, 1 ) +specular_metalness = 0.1 +specular_roughness = 0.8 +emission_enabled = false +normal_enabled = false +rim_enabled = false +clearcoat_enabled = false +anisotropy_enabled = false +ao_enabled = false +height_enabled = false +subsurf_scatter_enabled = false +refraction_enabled = false +detail_enabled = false +uv1_scale = Vector2( 1, 1 ) +uv1_offset = Vector2( 0, 0 ) +uv2_scale = Vector2( 1, 1 ) +uv2_offset = Vector2( 0, 0 ) + diff --git a/hud.tscn b/hud.tscn new file mode 100644 index 0000000..0972314 --- /dev/null +++ b/hud.tscn @@ -0,0 +1,242 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://scripts/hud.gd" type="Script" id=1] +[ext_resource path="res://scripts/multiverse_shop.gd" type="Script" id=2] + +[node name="HUD" type="Node"] + +script = ExtResource( 1 ) + +[node name="ms_button" type="Button" parent="."] + +margin_left = 620.0 +margin_top = 30.0 +margin_right = 752.0 +margin_bottom = 55.0 +rect_clip_content = false +hint_tooltip = "The best resources in the whole multi-verse!" +mouse_filter = 0 +toggle_mode = true +enabled_focus_mode = 2 +shortcut = null +group = null +text = "Multiverse Shop" +flat = false + +[node name="ms" type="Control" parent="."] + +rect_clip_content = false +mouse_filter = 0 +script = ExtResource( 2 ) + +[node name="tabs" type="TabContainer" parent="ms"] + +margin_left = 620.0 +margin_top = 56.0 +margin_right = 893.0 +margin_bottom = 486.0 +rect_clip_content = false +mouse_filter = 0 +tab_align = 0 +tabs_visible = true + +[node name="*" type="Tabs" parent="ms/tabs"] + +editor/display_folded = true +anchor_right = 1 +anchor_bottom = 1 +margin_left = 4.0 +margin_top = 32.0 +margin_right = 4.0 +margin_bottom = 4.0 +rect_clip_content = false +mouse_filter = 0 + +[node name="items" type="Tree" parent="ms/tabs/*"] + +anchor_right = 1 +anchor_bottom = 1 +margin_left = 5.0 +margin_top = 5.0 +margin_right = 3.0 +margin_bottom = 31.0 +mouse_filter = 0 + +[node name="**" type="Tabs" parent="ms/tabs"] + +editor/display_folded = true +visible = false +anchor_right = 1 +anchor_bottom = 1 +margin_left = 4.0 +margin_top = 32.0 +margin_right = 4.0 +margin_bottom = 4.0 +rect_clip_content = false +mouse_filter = 0 + +[node name="items" type="Tree" parent="ms/tabs/**"] + +anchor_right = 1 +anchor_bottom = 1 +margin_left = 5.0 +margin_top = 5.0 +margin_right = 3.0 +margin_bottom = 31.0 +mouse_filter = 0 + +[node name="***" type="Tabs" parent="ms/tabs"] + +editor/display_folded = true +visible = false +anchor_right = 1 +anchor_bottom = 1 +margin_left = 4.0 +margin_top = 32.0 +margin_right = 4.0 +margin_bottom = 4.0 +rect_clip_content = false +mouse_filter = 0 + +[node name="items" type="Tree" parent="ms/tabs/***"] + +anchor_right = 1 +anchor_bottom = 1 +margin_left = 5.0 +margin_top = 5.0 +margin_right = 3.0 +margin_bottom = 31.0 +mouse_filter = 0 + +[node name="other" type="Tabs" parent="ms/tabs"] + +editor/display_folded = true +visible = false +anchor_right = 1 +anchor_bottom = 1 +margin_left = 4.0 +margin_top = 32.0 +margin_right = 4.0 +margin_bottom = 4.0 +rect_clip_content = false +mouse_filter = 0 + +[node name="items" type="Tree" parent="ms/tabs/other"] + +anchor_right = 1 +anchor_bottom = 1 +margin_left = 5.0 +margin_top = 5.0 +margin_right = 3.0 +margin_bottom = 31.0 +mouse_filter = 0 + +[node name="panel" type="Panel" parent="ms"] + +margin_left = 895.0 +margin_top = 80.0 +margin_right = 990.0 +margin_bottom = 485.0 +rect_clip_content = false +mouse_filter = 0 + +[node name="buy" type="Button" parent="ms/panel"] + +anchor_right = 1 +anchor_bottom = 1 +margin_left = 9.0 +margin_top = 353.0 +margin_right = 10.0 +margin_bottom = 11.0 +rect_clip_content = false +mouse_filter = 0 +toggle_mode = false +enabled_focus_mode = 2 +shortcut = null +group = null +text = "Buy" +flat = false + +[node name="storage_button" type="Button" parent="."] + +margin_left = 755.0 +margin_top = 30.0 +margin_right = 814.0 +margin_bottom = 55.0 +rect_clip_content = false +mouse_filter = 0 +toggle_mode = true +enabled_focus_mode = 2 +shortcut = null +group = null +text = "Storage" +flat = false + +[node name="storage" type="Control" parent="."] + +visible = false +rect_clip_content = false +mouse_filter = 0 + +[node name="panel" type="Panel" parent="storage"] + +margin_left = 755.0 +margin_top = 55.0 +margin_right = 990.0 +margin_bottom = 485.0 +rect_clip_content = false +mouse_filter = 0 + +[node name="items" type="Tree" parent="storage/panel"] + +margin_left = 15.0 +margin_top = 10.0 +margin_right = 220.0 +margin_bottom = 410.0 +mouse_filter = 0 + +[node name="funds" type="PanelContainer" parent="."] + +margin_left = 815.0 +margin_top = 28.0 +margin_right = 946.0 +margin_bottom = 57.0 +rect_clip_content = false +mouse_filter = 0 + +[node name="label" type="Label" parent="funds"] + +margin_left = 7.0 +margin_top = 7.0 +margin_right = 124.0 +margin_bottom = 21.0 +rect_clip_content = false +mouse_filter = 2 +size_flags_vertical = 0 +text = "Funds:" +valign = 1 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="cash" type="Label" parent="funds"] + +margin_left = 65.0 +margin_top = 7.0 +margin_right = 65.0 +margin_bottom = 21.0 +rect_clip_content = false +mouse_filter = 2 +size_flags_horizontal = 0 +size_flags_vertical = 0 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[connection signal="pressed" from="ms_button" to="." method="_on_ms_button_pressed"] + +[connection signal="pressed" from="ms/panel/buy" to="ms" method="_on_buy_pressed"] + +[connection signal="pressed" from="storage_button" to="." method="_on_storage_button_pressed"] + + diff --git a/incubator.tscn b/incubator.tscn index 4acd66f..3f5d131 100644 --- a/incubator.tscn +++ b/incubator.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://mesh/incubator.dae" type="PackedScene" id=1] [ext_resource path="res://scripts/incubator.gd" type="Script" id=2] +[ext_resource path="res://gray_mat.tres" type="Material" id=3] -[sub_resource type="ConvexPolygonShape" id=4] +[sub_resource type="ConvexPolygonShape" id=1] points = PoolVector3Array( 1, -1, 1, -0.999512, -1, -1, 1, -1, -0.999512, -0.999512, 1, -1, 0.999512, 1, 1, 1, 1, -0.999512, 1, 1, -0.999512, 1, -1, 1, 1, -1, -0.999512, 0.999512, 1, 1, -1, -1, 0.999512, 1, -1, 1, -1, -1, 0.999512, -0.999512, 1, -1, -0.999512, -1, -1, 1, -1, -0.999512, -0.999512, 1, -1, 1, 1, -0.999512, -1, -1, 0.999512, -1, 1, 0.999512, 0.999512, 1, 1, -1, 1, 0.999512, -1, 1, 0.999512, -0.999512, -1, -1 ) @@ -54,13 +55,14 @@ script = ExtResource( 2 ) [node name="Cube" parent="."] editor/display_folded = true +material_override = ExtResource( 3 ) [node name="StaticBody" type="StaticBody" parent="Cube"] input_ray_pickable = true input_capture_on_drag = false shape_count = 1 -shapes/0/shape = SubResource( 4 ) +shapes/0/shape = SubResource( 1 ) shapes/0/transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) shapes/0/trigger = true collision_layer = 1 @@ -72,13 +74,14 @@ constant_angular_velocity = Vector3( 0, 0, 0 ) [node name="CollisionShape" type="CollisionShape" parent="Cube/StaticBody"] -shape = SubResource( 4 ) +shape = SubResource( 1 ) trigger = true _update_shape_index = 0 [node name="Cube.1" parent="."] editor/display_folded = true +material_override = ExtResource( 3 ) [node name="StaticBody" type="StaticBody" parent="Cube.1"] @@ -101,6 +104,38 @@ shape = SubResource( 2 ) trigger = true _update_shape_index = 0 +[node name="Cylinder" parent="."] + +material_override = ExtResource( 3 ) + +[node name="Cylinder.1" parent="."] + +material_override = ExtResource( 3 ) + +[node name="Cylinder.2" parent="."] + +material_override = ExtResource( 3 ) + +[node name="Cylinder.3" parent="."] + +material_override = ExtResource( 3 ) + +[node name="Cylinder.4" parent="."] + +material_override = ExtResource( 3 ) + +[node name="Cylinder.5" parent="."] + +material_override = ExtResource( 3 ) + +[node name="Cylinder.6" parent="."] + +material_override = ExtResource( 3 ) + +[node name="Cylinder.7" parent="."] + +material_override = ExtResource( 3 ) + [node name="cover" parent="."] material_override = SubResource( 3 ) @@ -145,7 +180,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.732647, 1.64196, -0.97198 ) [node name="point" type="Camera" parent="."] -transform = Transform( -3.09086e-08, -0.707107, 0.707107, -1.28028e-08, 0.707107, 0.707107, -1, 1.28028e-08, -3.09086e-08, 2.2, 3, 0 ) +transform = Transform( -3.09086e-08, -0.707107, 0.707107, -1.28028e-08, 0.707107, 0.707107, -1, 1.28028e-08, -3.09086e-08, 2.2, 3.5, 0 ) projection = 0 fov = 60.0 near = 0.1 @@ -157,6 +192,26 @@ environment = null h_offset = 0.0 v_offset = 0.0 +[node name="OmniLight" type="OmniLight" parent="."] + +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1.05032, 2.05093, 1.5916 ) +layers = 1 +light_color = Color( 1, 1, 1, 1 ) +light_energy = 5.0 +light_negative = false +light_specular = 0.5 +light_cull_mask = -1 +shadow_enabled = true +shadow_color = Color( 0, 0, 0, 1 ) +shadow_bias = 0.1 +shadow_contact = 0.0 +shadow_max_distance = 0.0 +editor_only = false +omni_range = 5.0 +omni_attenuation = 1.0 +omni_shadow_mode = 0 +omni_shadow_detail = 1 + [connection signal="input_event" from="Cube/StaticBody" to="." method="_on_body_input_event"] [connection signal="input_event" from="Cube.1/StaticBody" to="." method="_on_panel_input_event"] diff --git a/ld38.godot b/ld38.godot index 93eb744..653f11f 100644 --- a/ld38.godot +++ b/ld38.godot @@ -1,7 +1,9 @@ config_version=3 +config_version=null + [application] -name="ld38" +name="World Factory^TM" main_scene="res://base.tscn" icon="res://icon.png" diff --git a/player.tscn b/player.tscn new file mode 100644 index 0000000..f10ca42 --- /dev/null +++ b/player.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://scripts/player.gd" type="Script" id=1] + +[node name="Player" type="Node"] + +script = ExtResource( 1 ) + + diff --git a/scripts/base.gd b/scripts/base.gd index 6b48222..f89eedc 100644 --- a/scripts/base.gd +++ b/scripts/base.gd @@ -7,6 +7,7 @@ var Incubator = preload("res://incubator.tscn") var cam = null func _ready(): + randomize() self.cam = get_node("Camera") func _process(delta): @@ -20,18 +21,21 @@ func _input(event): elif event.button_index == BUTTON_WHEEL_UP: self.cam.translate(Vector3(0,0,-0.1)) self.cam.reselect() + elif event.button_index == BUTTON_RIGHT: + self.cam.reset() if event.type == InputEvent.MOUSE_MOTION and event.button_mask == BUTTON_MASK_MIDDLE: - get_node("Camera").rot_around(event.relative_x/(30)) + self.cam.rot_around(event.relative_x/(30)) + if event.type == InputEvent.KEY: if event.scancode == KEY_A: - get_node("Camera").translate(Vector3(-0.1,0,0)) + self.cam.translate(Vector3(-0.1,0,0)) if event.scancode == KEY_D: - get_node("Camera").translate(Vector3(0.1,0,0)) + self.cam.translate(Vector3(0.1,0,0)) if event.scancode == KEY_S: - get_node("Camera").translate(Vector3(0,-0.1,0)) + self.cam.translate(Vector3(0,-0.1,0)) if event.scancode == KEY_W: - get_node("Camera").translate(Vector3(0,0.1,0)) + self.cam.translate(Vector3(0,0.1,0)) if event.scancode == KEY_H: - var s = get_node("Camera").get_selected() + var s = self.cam.get_selected() if s != null: get_node("Incubator").push_world(s) \ No newline at end of file diff --git a/scripts/camera.gd b/scripts/camera.gd index 814a549..b099e16 100644 --- a/scripts/camera.gd +++ b/scripts/camera.gd @@ -3,13 +3,16 @@ extends InterpolatedCamera var selected = null func _ready(): - set_target(get_parent().get_node("overview")) - self.selected = get_parent().get_node("center") + reset() func select(what, new_target): + print("before set") set_target(new_target) + print("after set") if self.selected != what: + print("before interp") set_interpolation_enabled(true) + print("after interp") #set_translation(what.translation + Vector3(1,3,0)) self.selected = what @@ -24,6 +27,11 @@ func rot_around(amount): var rotated = relative.rotated(Vector3(0,1,0), amount) set_translation(self.selected.translation + rotated) reselect() + +func reset(): + set_target(get_parent().get_node("overview")) + set_interpolation_enabled(true) + self.selected = get_parent().get_node("center") func get_selected(): return self.selected \ No newline at end of file diff --git a/scripts/combinator_panel.gd b/scripts/combinator_panel.gd new file mode 100644 index 0000000..333187f --- /dev/null +++ b/scripts/combinator_panel.gd @@ -0,0 +1,14 @@ +extends Panel + +func _ready(): + set_process_input(true) + +func _input(event): + print(event) + +func _on_Tree_gui_input( ev ): + #print(ev) + pass + +func _on_Tree_mouse_entered(): + print("enter") diff --git a/scripts/hud.gd b/scripts/hud.gd new file mode 100644 index 0000000..4028192 --- /dev/null +++ b/scripts/hud.gd @@ -0,0 +1,16 @@ +extends Node + +func _ready(): + pass + +func _on_ms_button_pressed(): + var visible = get_node("ms").is_visible() + get_node("ms").set_visible(!visible) + if !visible: + get_node("storage").set_visible(false) + +func _on_storage_button_pressed(): + var visible = get_node("storage").is_visible() + get_node("storage").set_visible(!visible) + if !visible: + get_node("ms").set_visible(false) diff --git a/scripts/multiverse_shop.gd b/scripts/multiverse_shop.gd new file mode 100644 index 0000000..177c874 --- /dev/null +++ b/scripts/multiverse_shop.gd @@ -0,0 +1,53 @@ +extends Control + +var data = null + +func _ready(): + var map = {"1": get_node("tabs/*/items"), + "2": get_node("tabs/**/items"), + "3": get_node("tabs/***/items"), + "other": get_node("tabs/other/items")} + var file = File.new() + file.open("res://assets/shop.json", File.READ) + var content = file.get_as_text() + file.close() + self.data = parse_json(content) + for k in self.data.keys(): + var tree = map[k] + var root = tree.create_item() + tree.set_columns(2) + tree.set_column_title(0, "Item") + tree.set_column_title(1, "Cost") + tree.set_column_titles_visible(true) + tree.set_column_expand(1, false) + tree.set_column_min_width(1,40) + tree.set_hide_root(true) + tree.set_select_mode(Tree.SELECT_ROW) + for i in range(self.data[k].size()): + var item = self.data[k][i] + var itm = tree.create_item(root) + itm.set_text(0, item["name"]) + itm.set_text(1, str(item["cost"])) + itm.set_tooltip(0, item["desc"]) + itm.set_metadata(0, item) + itm.set_collapsed(true) + + var desc = tree.create_item(itm) + desc.set_text(0, item["desc"]) + desc.set_selectable(0, false) + +func _on_buy_pressed(): + var tab = get_node("tabs").get_current_tab_control() + var tree = tab.get_node("items") + var itm = tree.get_selected() + if itm != null and itm.is_selected(0): + var item = itm.get_metadata(0) + var player = get_tree().get_root().get_node("Game/Player") + if player.cash >= item["cost"]: + if player.storage.has(item["id"]): + player.storage[item["id"]] += 1 + else: + player.storage[item["id"]] = 1 + player.cash -= item["cost"] + else: + pass \ No newline at end of file diff --git a/scripts/player.gd b/scripts/player.gd new file mode 100644 index 0000000..85c5f9e --- /dev/null +++ b/scripts/player.gd @@ -0,0 +1,17 @@ +extends Node + +var cash = 1000 setget set_cash, get_cash +var storage = {} + +func _ready(): + _update_hud() + +func get_cash(): + return cash + +func set_cash(csh): + cash = csh + _update_hud() + +func _update_hud(): + get_tree().get_root().get_node("Game/HUD/funds/cash").set_text(str(cash)) \ No newline at end of file diff --git a/scripts/world.gd b/scripts/world.gd index 89df926..9117678 100644 --- a/scripts/world.gd +++ b/scripts/world.gd @@ -41,5 +41,7 @@ func _make_ball(size, center): line_y.append(null) func _on_click(): + print("click") var cam = get_tree().get_root().get_camera() - cam.select(self, get_node("point")) \ No newline at end of file + cam.select(self, get_node("point")) + cam.reselect() \ No newline at end of file diff --git a/world.tscn b/world.tscn index 8269412..d595577 100644 --- a/world.tscn +++ b/world.tscn @@ -6,9 +6,9 @@ script = ExtResource( 1 ) -[node name="OmniLight" type="OmniLight" parent="."] +[node name="spot" type="SpotLight" parent="."] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 20, 0 ) +transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 20, 0 ) layers = 1 light_color = Color( 0.819993, 0.824219, 0.283325, 1 ) light_energy = 3.0 @@ -21,14 +21,14 @@ shadow_bias = 5.0 shadow_contact = 0.0 shadow_max_distance = 45.0 editor_only = false -omni_range = 45.0 -omni_attenuation = 1.0 -omni_shadow_mode = 1 -omni_shadow_detail = 1 +spot_range = 30.0 +spot_attenuation = 1.0 +spot_angle = 35.0 +spot_angle_attenuation = 1.0 [node name="point" type="Camera" parent="."] -transform = Transform( -3.09086e-08, -0.707107, 0.707107, -1.28028e-08, 0.707107, 0.707107, -1, 1.28028e-08, -3.09086e-08, 2.2, 3, 0 ) +transform = Transform( -3.09086e-08, -0.707107, 0.707107, -1.28028e-08, 0.707107, 0.707107, -1, 1.28028e-08, -3.09086e-08, 2, 3, 0 ) projection = 0 fov = 60.0 near = 0.1 -- cgit v1.2.3-70-g09d2