From 4859dc56e8e3d33bd6e15d49dd634019482106c5 Mon Sep 17 00:00:00 2001 From: Daniel Snider Date: Sat, 13 Aug 2022 22:11:03 -0700 Subject: [PATCH 1/5] Configure joystick --- project.godot | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/project.godot b/project.godot index f73bbdc..aca03c8 100644 --- a/project.godot +++ b/project.godot @@ -101,21 +101,25 @@ common/drop_mouse_on_gui_input_disabled=true up={ "deadzone": 0.5, "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":87,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null) ] } down={ "deadzone": 0.5, "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":83,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null) ] } left={ "deadzone": 0.5, "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":65,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null) ] } right={ "deadzone": 0.5, "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":68,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null) ] } action={ From ea7dece84e9cab5c06cc32cf1a06affb85219e00 Mon Sep 17 00:00:00 2001 From: Daniel Snider Date: Sat, 13 Aug 2022 22:12:13 -0700 Subject: [PATCH 2/5] Shrink interact collision shapes --- scenes/coin_machine.tscn | 3 +-- scenes/player.tscn | 5 +++-- scenes/power_station.tscn | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scenes/coin_machine.tscn b/scenes/coin_machine.tscn index 098f850..5771d45 100644 --- a/scenes/coin_machine.tscn +++ b/scenes/coin_machine.tscn @@ -2,11 +2,10 @@ [ext_resource path="res://scripts/coin_machine.gd" type="Script" id=1] -[sub_resource type="SphereShape" id=1] +[sub_resource type="BoxShape" id=1] [node name="coin_machine" type="Area"] script = ExtResource( 1 ) [node name="CollisionShape" type="CollisionShape" parent="."] -transform = Transform( 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0 ) shape = SubResource( 1 ) diff --git a/scenes/player.tscn b/scenes/player.tscn index 377d89e..1ddce80 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -3,7 +3,8 @@ [ext_resource path="res://scripts/Player.gd" type="Script" id=1] [ext_resource path="res://assets/protodungman/DungMan.glb" type="PackedScene" id=2] -[sub_resource type="SphereShape" id=3] +[sub_resource type="BoxShape" id=3] +extents = Vector3( 0.25, 0.25, 1 ) [sub_resource type="CapsuleShape" id=2] radius = 0.210213 @@ -19,7 +20,7 @@ unique_name_in_owner = true transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.630386 ) [node name="CollisionShape" type="CollisionShape" parent="DungMan/TriggerVolume"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.168703 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.778807, 0.291356 ) shape = SubResource( 3 ) [node name="CollisionShape" type="CollisionShape" parent="."] diff --git a/scenes/power_station.tscn b/scenes/power_station.tscn index 57043a7..7c3bd52 100644 --- a/scenes/power_station.tscn +++ b/scenes/power_station.tscn @@ -13,7 +13,6 @@ script = ExtResource( 1 ) time_to_generate = 1.0 [node name="coin_machine" parent="." instance=ExtResource( 2 )] -transform = Transform( 4, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0 ) coins_required = 0 [node name="MeshInstance" type="MeshInstance" parent="."] From 60a6c1997ef530708f38e8acf70f79839c18929d Mon Sep 17 00:00:00 2001 From: Daniel Snider Date: Sat, 13 Aug 2022 22:17:55 -0700 Subject: [PATCH 3/5] Fix translation of hydroponics_station --- scenes/hydroponics_station.tscn | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scenes/hydroponics_station.tscn b/scenes/hydroponics_station.tscn index 14c4d94..2904f90 100644 --- a/scenes/hydroponics_station.tscn +++ b/scenes/hydroponics_station.tscn @@ -1,6 +1,5 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=6 format=2] -[ext_resource path="res://scripts/coin_machine.gd" type="Script" id=1] [ext_resource path="res://scripts/hydroponics_station.gd" type="Script" id=2] [ext_resource path="res://scenes/coin_machine.tscn" type="PackedScene" id=3] @@ -15,7 +14,6 @@ size = Vector3( 0.4, 1, 0.4 ) points = PoolVector3Array( -0.0608763, 0.449247, 0.974783, -0.0608763, -0.464612, -0.974783, -0.0608763, 0.449247, -0.974783, 0.974783, -0.464612, -0.0608763, -0.974783, -0.464612, 0.0608763, 0.974783, 0.449247, 0.0608763, 0.0606902, -0.464648, 0.97486, -0.974783, 0.449247, -0.0608763, 0.7071, 0.453517, -0.7071, -0.705748, -0.468, -0.705748, -0.7071, 0.453517, 0.7071, 0.7071, 0.453517, 0.7071, 0.705748, -0.468, 0.705748, -0.705748, -0.468, 0.705748, 0.705748, -0.468, -0.705748, -0.7071, 0.453517, -0.7071, 0.0606902, -0.464648, -0.97486, -0.974783, -0.464612, -0.0608763, 0.974783, -0.464612, 0.0608763, -0.0608763, -0.464612, 0.974783, 0.0606902, 0.449283, 0.97486, 0.0606902, 0.449283, -0.97486, 0.974783, 0.449247, -0.0608763, -0.974783, 0.449247, 0.0608763, -0.642208, -0.46642, 0.73398, -0.642208, -0.46642, -0.73398, 0.578116, -0.464071, -0.760529, 0.578116, -0.464071, 0.760529, 0.760589, -0.464107, 0.577971, -0.760589, -0.464107, 0.577971, -0.760589, -0.464107, -0.577971, 0.760589, -0.464107, -0.577971 ) [node name="hydroponics_station" type="Spatial"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 11.4134, 0, -2.96909 ) script = ExtResource( 2 ) [node name="MeshInstance" type="MeshInstance" parent="."] @@ -39,9 +37,8 @@ billboard = 1 transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.372095, 0 ) shape = SubResource( 2 ) -[node name="coin_machine" type="Area" parent="." instance=ExtResource( 3 )] +[node name="coin_machine" parent="." instance=ExtResource( 3 )] transform = Transform( 0.540026, 0, 0, 0, 0.571038, 0, 0, 0, 0.497953, 0, 0.418593, 0 ) -script = ExtResource( 1 ) [node name="grow_timer" type="Timer" parent="."] one_shot = true From 5e0c0958e71e1f454eb8a102da4ba6a31681178f Mon Sep 17 00:00:00 2001 From: Daniel Snider Date: Sat, 13 Aug 2022 22:27:10 -0700 Subject: [PATCH 4/5] Add silly dialog for yamget --- dialogic/folder_structure.json | 5 +++-- dialogic/settings.cfg | 4 ++++ dialogic/themes/default-theme.cfg | 5 +++++ dialogic/timelines/timeline-1660454153.json | 15 +++++++++++++++ scripts/hydroponics_station.gd | 1 + 5 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 dialogic/timelines/timeline-1660454153.json diff --git a/dialogic/folder_structure.json b/dialogic/folder_structure.json index 12f3165..e6a0055 100644 --- a/dialogic/folder_structure.json +++ b/dialogic/folder_structure.json @@ -36,13 +36,14 @@ }, "metadata": { "color": null, - "folded": true + "folded": false } }, "Timelines": { "files": [ "timeline-1660443870.json", - "timeline-1660444277.json" + "timeline-1660444277.json", + "timeline-1660454153.json" ], "folders": { diff --git a/dialogic/settings.cfg b/dialogic/settings.cfg index fe4dc31..e17b3aa 100644 --- a/dialogic/settings.cfg +++ b/dialogic/settings.cfg @@ -13,3 +13,7 @@ character_preview_mode=1 [QuickTimelineTest] timeline_file="timeline-1660443870.json" + +[animations] + +default_join_animation_length=0.5 diff --git a/dialogic/themes/default-theme.cfg b/dialogic/themes/default-theme.cfg index 1822bc0..ea112fe 100644 --- a/dialogic/themes/default-theme.cfg +++ b/dialogic/themes/default-theme.cfg @@ -16,3 +16,8 @@ disabled=[ false, Color( 1, 1, 1, 1 ), false, Color( 0, 0, 0, 1 ), true, "res:// [background] use_image=true +modulation=false + +[animation] + +show_time=0.1 diff --git a/dialogic/timelines/timeline-1660454153.json b/dialogic/timelines/timeline-1660454153.json new file mode 100644 index 0000000..7c74424 --- /dev/null +++ b/dialogic/timelines/timeline-1660454153.json @@ -0,0 +1,15 @@ +{ + "events": [ + { + "character": "", + "event_id": "dialogic_001", + "portrait": "", + "text": "You have acquired a raw yam." + } + ], + "metadata": { + "dialogic-version": "1.4.4", + "file": "timeline-1660454153.json", + "name": "yamget" + } +} diff --git a/scripts/hydroponics_station.gd b/scripts/hydroponics_station.gd index 23e510f..b07cae6 100644 --- a/scripts/hydroponics_station.gd +++ b/scripts/hydroponics_station.gd @@ -21,6 +21,7 @@ func _on_Timer_timeout(): func _on_yam_item_tree_exited(): $coin_machine.enabled = true $MeshInstance/Yam.visible = false + add_child(Dialogic.start("yamget")) func _process(delta): $"%status_label".text = "%f" % $grow_timer.time_left From 7e6b8c65034c14f1c25e27177e2c77a2ba9b181b Mon Sep 17 00:00:00 2001 From: Daniel Snider Date: Sun, 14 Aug 2022 01:00:14 -0700 Subject: [PATCH 5/5] Add incomplete hunger system --- assets/icons/stomach.png | 3 ++ assets/icons/stomach.png.import | 35 +++++++++++++++ dialogic/folder_structure.json | 3 +- dialogic/timelines/timeline-1660463789.json | 15 +++++++ scenes/player.tscn | 47 ++++++++++++++++++++- scripts/Player.gd | 14 ++++++ 6 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 assets/icons/stomach.png create mode 100644 assets/icons/stomach.png.import create mode 100644 dialogic/timelines/timeline-1660463789.json diff --git a/assets/icons/stomach.png b/assets/icons/stomach.png new file mode 100644 index 0000000..0732929 --- /dev/null +++ b/assets/icons/stomach.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38ceab83461618b2a6ddbfb54fb34a449bd701a62c0faec41d53810423ba9562 +size 16551 diff --git a/assets/icons/stomach.png.import b/assets/icons/stomach.png.import new file mode 100644 index 0000000..5bc7def --- /dev/null +++ b/assets/icons/stomach.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/stomach.png-43f18e7236b051f708f6adff5e1822c4.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/icons/stomach.png" +dest_files=[ "res://.import/stomach.png-43f18e7236b051f708f6adff5e1822c4.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 +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/dialogic/folder_structure.json b/dialogic/folder_structure.json index e6a0055..f0685de 100644 --- a/dialogic/folder_structure.json +++ b/dialogic/folder_structure.json @@ -43,7 +43,8 @@ "files": [ "timeline-1660443870.json", "timeline-1660444277.json", - "timeline-1660454153.json" + "timeline-1660454153.json", + "timeline-1660463789.json" ], "folders": { diff --git a/dialogic/timelines/timeline-1660463789.json b/dialogic/timelines/timeline-1660463789.json new file mode 100644 index 0000000..a59acaa --- /dev/null +++ b/dialogic/timelines/timeline-1660463789.json @@ -0,0 +1,15 @@ +{ + "events": [ + { + "character": "", + "event_id": "dialogic_001", + "portrait": "", + "text": "Looks like you've starved to death.\nBetter luck next time!" + } + ], + "metadata": { + "dialogic-version": "1.4.4", + "file": "timeline-1660463789.json", + "name": "starve" + } +} diff --git a/scenes/player.tscn b/scenes/player.tscn index 1ddce80..132f8e4 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://scripts/Player.gd" type="Script" id=1] [ext_resource path="res://assets/protodungman/DungMan.glb" type="PackedScene" id=2] +[ext_resource path="res://assets/icons/stomach.png" type="Texture" id=3] [sub_resource type="BoxShape" id=3] extents = Vector3( 0.25, 0.25, 1 ) @@ -30,3 +31,47 @@ shape = SubResource( 2 ) [node name="Camera" type="Camera" parent="."] transform = Transform( 1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 5.44166, 3.39746 ) fov = 50.0 + +[node name="UI" type="CanvasLayer" parent="."] + +[node name="Control" type="Control" parent="UI"] +margin_right = 40.0 +margin_bottom = 40.0 + +[node name="MarginContainer" type="MarginContainer" parent="UI/Control"] +margin_right = 128.0 +margin_bottom = 128.0 +custom_constants/margin_right = 16 +custom_constants/margin_top = 16 +custom_constants/margin_left = 16 +custom_constants/margin_bottom = 16 + +[node name="stomachs" type="HBoxContainer" parent="UI/Control/MarginContainer"] +unique_name_in_owner = true +margin_left = 16.0 +margin_top = 16.0 +margin_right = 540.0 +margin_bottom = 144.0 + +[node name="stomach0" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"] +margin_right = 128.0 +margin_bottom = 128.0 +texture = ExtResource( 3 ) + +[node name="stomach1" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"] +margin_left = 132.0 +margin_right = 260.0 +margin_bottom = 128.0 +texture = ExtResource( 3 ) + +[node name="stomach2" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"] +margin_left = 264.0 +margin_right = 392.0 +margin_bottom = 128.0 +texture = ExtResource( 3 ) + +[node name="stomach3" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"] +margin_left = 396.0 +margin_right = 524.0 +margin_bottom = 128.0 +texture = ExtResource( 3 ) diff --git a/scripts/Player.gd b/scripts/Player.gd index c45af56..6782d66 100644 --- a/scripts/Player.gd +++ b/scripts/Player.gd @@ -4,6 +4,7 @@ const EPSILON = 0.0001 const SPEED = 3.0 export var inventory = { "ore" : 0 } +var health: int = 4 setget set_health # Called when the node enters the scene tree for the first time. func _ready(): @@ -16,6 +17,19 @@ func _physics_process(delta): $DungMan.look_at(global_transform.origin - motion, Vector3.UP) move_and_slide(motion) +func set_health(new_value): + health = min(new_value, 4) + for child in $"%stomachs".get_children(): + child.visible = child.get_index() < health + if health <= 0: + var node = Dialogic.start("starve") + node.pause_mode = PAUSE_MODE_PROCESS + add_child(node) + get_tree().paused = true + yield(node, "timeline_end") + get_tree().paused = false + get_tree().quit() # go back to main menu when such a thing exists + func can_afford(item_name, item_amount): assert(item_amount > 0) var current_amount : int = 0