From 8b4ac85131e6424c617c19cc8581ba30201b6279 Mon Sep 17 00:00:00 2001 From: "Telmo \"Trooper" Date: Tue, 11 Jul 2023 00:32:10 -0300 Subject: [PATCH] Get Godot head when Tiki is saved; Tiki is happy to see the player again (#221) * Updated exports * Removed 'dialogic' settings * Fixed bug on 'finished' dialog event; Added dialog after Tiki is saved * Show godot head when tiki is freed * Added GameState event when tiki is freed * New game resets events * Godot head can only be collected if visible * Added text when player approaches tiki * Tiki is happy to see the player again --- autoload/game_state.gd | 10 ++- export_presets.cfg | 30 +++---- maps/avocado_beach.gd | 3 + maps/avocado_beach.tscn | 85 ++++++++++++++++++- maps/extras/caged_tiki_npc/caged_tiki_npc.gd | 38 ++++++++- .../extras/caged_tiki_npc/caged_tiki_npc.tscn | 21 ++++- maps/hub_1.gd | 2 - maps/hub_1.tscn | 2 +- project.godot | 37 -------- props/godot_head/godot_head.gd | 2 +- ui/dialog.gd | 1 + 11 files changed, 163 insertions(+), 68 deletions(-) diff --git a/autoload/game_state.gd b/autoload/game_state.gd index 68294a9d..741b47ba 100644 --- a/autoload/game_state.gd +++ b/autoload/game_state.gd @@ -28,7 +28,8 @@ var godot_heads_collected = { "BeachGodotHead": false, "BridgeGodotHead": false, "PalmTreeGodotHead": false, - "SandRampGodotHead": false + "SandRampGodotHead": false, + "CagedTikiGodotHead": false }, "LakeMap": { "GodotHead": false, @@ -60,6 +61,10 @@ var cutscenes_played = { "avocado_beach_preview": false } +var events = { + "tiki_freed": false +} + var collision_layers = {} const initial_grass = 3000 @@ -104,6 +109,9 @@ func initialize() -> void: # Used in "New Game". for property in cutscenes_played: cutscenes_played[property] = false + for property in events: + events[property] = false + hub_1_at_night = true gems_collected = {} godot_heads_collected = bytes_to_var(initial_godot_heads_collected) diff --git a/export_presets.cfg b/export_presets.cfg index 56615cd3..818878a5 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -13,13 +13,12 @@ encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false encrypt_directory=false -script_encryption_key="" [preset.0.options] custom_template/debug="" custom_template/release="" -debug/export_console_script=1 +debug/export_console_wrapper=1 binary_format/embed_pck=true texture_format/bptc=true texture_format/s3tc=true @@ -54,13 +53,12 @@ encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false encrypt_directory=false -script_encryption_key="" [preset.1.options] custom_template/debug="" custom_template/release="" -debug/export_console_script=1 +debug/export_console_wrapper=1 binary_format/embed_pck=true texture_format/bptc=true texture_format/s3tc=true @@ -68,9 +66,6 @@ texture_format/etc=false texture_format/etc2=false binary_format/architecture="x86_64" codesign/enable=false -codesign/identity_type=0 -codesign/identity="" -codesign/password="" codesign/timestamp=true codesign/timestamp_server_url="" codesign/digest_algorithm=1 @@ -120,14 +115,14 @@ encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false encrypt_directory=false -script_encryption_key="" [preset.2.options] +export/distribution_type=1 binary_format/architecture="universal" custom_template/debug="" custom_template/release="" -debug/export_console_script=1 +debug/export_console_wrapper=1 application/icon="" application/icon_interpolation=4 application/bundle_identifier="net.telmotrooper.squashthecreeps" @@ -137,11 +132,18 @@ application/short_version="1.0" application/version="1.0" application/copyright="" application/copyright_localized={} +application/min_macos_version="10.12" display/high_res=false +xcode/platform_build="14C18" +xcode/sdk_version="13.1" +xcode/sdk_build="22C55" +xcode/sdk_name="macosx13.1" +xcode/xcode_version="1420" +xcode/xcode_build="14C18" codesign/codesign=1 +codesign/installer_identity="" +codesign/apple_team_id="" codesign/identity="" -codesign/certificate_file="" -codesign/certificate_password="" codesign/entitlements/custom_file="" codesign/entitlements/allow_jit_code_execution=false codesign/entitlements/allow_unsigned_executable_memory=false @@ -167,12 +169,6 @@ codesign/entitlements/app_sandbox/files_movies=0 codesign/entitlements/app_sandbox/helper_executables=[] codesign/custom_options=PackedStringArray() notarization/notarization=0 -notarization/apple_id_name="" -notarization/apple_id_password="" -notarization/apple_team_id="" -notarization/api_uuid="" -notarization/api_key="" -notarization/api_key_id="" privacy/microphone_usage_description="" privacy/microphone_usage_description_localized={} privacy/camera_usage_description="" diff --git a/maps/avocado_beach.gd b/maps/avocado_beach.gd index f212a2fa..b22518a1 100644 --- a/maps/avocado_beach.gd +++ b/maps/avocado_beach.gd @@ -31,3 +31,6 @@ func set_minimap_visible(value: bool) -> void: func hide_map_name() -> void: GameState.UserInterface.get_node("MapName").hide() + +func _on_tiki_freed(): + $CagedTikiNPC/CagedTikiGodotHeadAnimationPlayer.play("appear") diff --git a/maps/avocado_beach.tscn b/maps/avocado_beach.tscn index 8629775d..f64bacf4 100644 --- a/maps/avocado_beach.tscn +++ b/maps/avocado_beach.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=88 format=3 uid="uid://bji1tdapoh0ct"] +[gd_scene load_steps=91 format=3 uid="uid://bji1tdapoh0ct"] [ext_resource type="Script" path="res://maps/avocado_beach.gd" id="1_1tay5"] [ext_resource type="AudioStream" uid="uid://c1y5qugat84ue" path="res://assets/house_in_a_forest_loop.ogg" id="2_livli"] @@ -525,6 +525,79 @@ _data = { "preview": SubResource("Animation_i3fst") } +[sub_resource type="Animation" id="Animation_ku3vj"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("CagedTikiGodotHead:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector3(1, 1, 1)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("CagedTikiGodotHead:visible") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} + +[sub_resource type="Animation" id="Animation_umxow"] +resource_name = "appear" +length = 0.5 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("CagedTikiGodotHead:rotation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector3(0, 1.5708, 0), Vector3(0, 7.85398, 0)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("CagedTikiGodotHead:scale") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector3(0, 0, 0), Vector3(1, 1, 1)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("CagedTikiGodotHead:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_p5igw"] +_data = { +"RESET": SubResource("Animation_ku3vj"), +"appear": SubResource("Animation_umxow") +} + [node name="AvocadoBeach" type="Node3D"] script = ExtResource("1_1tay5") map_music = ExtResource("2_livli") @@ -1346,10 +1419,20 @@ transform = Transform3D(1, 0, 0, 0, 0.965926, 0.258819, 0, -0.258819, 0.965926, [node name="CagedTikiNPC" parent="." instance=ExtResource("44_wr07v")] transform = Transform3D(0.866025, 0, -0.5, 0, 1, 0, 0.5, 0, 0.866025, 13.7607, 0.0819117, -256.247) +[node name="CagedTikiGodotHead" parent="CagedTikiNPC" instance=ExtResource("17_tburi")] +transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -5.2, 3, 3) +visible = false + +[node name="CagedTikiGodotHeadAnimationPlayer" type="AnimationPlayer" parent="CagedTikiNPC"] +libraries = { +"": SubResource("AnimationLibrary_p5igw") +} + [connection signal="pressed" from="Map/GreenPlatform2/Ramp/RedButton" to="." method="_on_RedButton_pressed"] [connection signal="animation_finished" from="Map/MovingPlatforms/Manual/AnimationPlayer" to="Map/MovingPlatforms/Manual" method="_on_AnimationPlayer_animation_finished"] [connection signal="timeout" from="Map/MovingPlatforms/Manual/MovingPlatformTimer" to="Map/MovingPlatforms/Manual" method="_on_FloatingPlatformTimer_timeout"] [connection signal="body_entered" from="Map/BlueCube/SprintTutorial" to="." method="_on_SprintTutorial_body_entered"] +[connection signal="tiki_freed" from="CagedTikiNPC" to="." method="_on_tiki_freed"] [editable path="SandPlatform/Isle/isle"] [editable path="SandPlatform/IslePath/isle_path"] diff --git a/maps/extras/caged_tiki_npc/caged_tiki_npc.gd b/maps/extras/caged_tiki_npc/caged_tiki_npc.gd index 37eea4f7..d633e324 100644 --- a/maps/extras/caged_tiki_npc/caged_tiki_npc.gd +++ b/maps/extras/caged_tiki_npc/caged_tiki_npc.gd @@ -1,15 +1,45 @@ extends Node3D +signal tiki_freed + +func _ready() -> void: + if GameState.events.tiki_freed: + $CageStaticBody3D.queue_free() + $AnimationPlayer.stop() + $tiki_npc/Label3D.hide() + func free_tiki() -> void: $AnimationPlayer.stop() - var tween = create_tween() - # Move Tiki to the floor. - tween.tween_property($tiki_npc, "position:y",0, 0.25) $tiki_npc/Label3D.hide() - await get_tree().create_timer(1).timeout + + # Move Tiki to the floor. + create_tween().tween_property($tiki_npc, "position:y", 0, 0.25) + + GameState.dialog.set_text( + "Thanks for saving me, maaan!\n" + + "I found this blue thingy in the beach... you can have it." + ) + GameState.dialog.open_dialog() + + await GameState.dialog.finished + $tiki_npc/Label3D.text = "THANKS!" $tiki_npc/Label3D.show() var tween_2 = create_tween().set_loops() tween_2.tween_property($tiki_npc, "position:y", 0.5, 0.25) tween_2.tween_property($tiki_npc, "position:y", 0, 0.25) + GameState.events.tiki_freed = true + emit_signal("tiki_freed") + +func _on_area_3d_body_entered(body): + if GameState.events.tiki_freed: + $tiki_npc/Label3D.text = "Hey, maaan!" + $tiki_npc/Label3D.show() + var tween = create_tween().set_loops(2) + tween.tween_property($tiki_npc, "position:y", 0.5, 0.25) + tween.tween_property($tiki_npc, "position:y", 0, 0.25) + +func _on_area_3d_body_exited(body): + if GameState.events.tiki_freed: + $tiki_npc/Label3D.hide() diff --git a/maps/extras/caged_tiki_npc/caged_tiki_npc.tscn b/maps/extras/caged_tiki_npc/caged_tiki_npc.tscn index 8c1740da..3f7ced20 100644 --- a/maps/extras/caged_tiki_npc/caged_tiki_npc.tscn +++ b/maps/extras/caged_tiki_npc/caged_tiki_npc.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=3 uid="uid://by4x3rbps47k6"] +[gd_scene load_steps=11 format=3 uid="uid://by4x3rbps47k6"] [ext_resource type="PackedScene" uid="uid://nkarq1qbnp1v" path="res://props/cage/cage.blend" id="1_uac30"] [ext_resource type="Script" path="res://maps/extras/caged_tiki_npc/caged_tiki_npc.gd" id="1_uxdyq"] @@ -71,6 +71,9 @@ _data = { [sub_resource type="BoxShape3D" id="BoxShape3D_q38xr"] size = Vector3(6, 5.2, 6) +[sub_resource type="SphereShape3D" id="SphereShape3D_nvae3"] +radius = 10.0 + [node name="CagedTikiNPC" type="Node3D"] script = ExtResource("1_uxdyq") @@ -88,17 +91,27 @@ transform = Transform3D(-1, 0, 2.53518e-06, 0, 1, 0, -2.53518e-06, 0, -1, 0, 0, [node name="Label3D" type="Label3D" parent="tiki_npc"] transform = Transform3D(-1, 0, -2.53518e-06, 0, 1, 0, 2.53518e-06, 0, -1, 0, 5.8, 0) pixel_size = 0.025 +billboard = 2 text = "HELP!" font = ExtResource("3_63fx1") -[node name="StaticBody3D" type="StaticBody3D" parent="." groups=["spinnable"]] +[node name="CageStaticBody3D" type="StaticBody3D" parent="." groups=["spinnable"]] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.183237, 0, 0.383657) collision_layer = 64 script = ExtResource("3_376bk") -[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="CageStaticBody3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.192559, 2.5, -0.4) shape = SubResource("BoxShape3D_q38xr") -[node name="cage" parent="StaticBody3D" instance=ExtResource("1_uac30")] +[node name="cage" parent="CageStaticBody3D" instance=ExtResource("1_uac30")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.183237, 0, -0.383657) + +[node name="Area3D" type="Area3D" parent="."] +collision_layer = 16 + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"] +shape = SubResource("SphereShape3D_nvae3") + +[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"] +[connection signal="body_exited" from="Area3D" to="." method="_on_area_3d_body_exited"] diff --git a/maps/hub_1.gd b/maps/hub_1.gd index fb64f2e7..276d9c3a 100644 --- a/maps/hub_1.gd +++ b/maps/hub_1.gd @@ -45,5 +45,3 @@ func _on_AudioStreamPlayer_finished() -> void: func _on_CutsceneAnimationPlayer_animation_finished(_anim_name: String) -> void: GameState.dialog.set_text("The ship is completely busted... I won't be able to get out of here easily. Where IS here though?") GameState.dialog.open_dialog() - await GameState.dialog.finished - GameState.UserInterface.get_node("%Minimap").show() diff --git a/maps/hub_1.tscn b/maps/hub_1.tscn index 186e8e74..0f1c2ef9 100644 --- a/maps/hub_1.tscn +++ b/maps/hub_1.tscn @@ -313,7 +313,7 @@ transform = Transform3D(0.939693, 0.34202, 0, -0.34202, 0.939693, 0, 0, 0, 1, 8. script = ExtResource("18") [node name="Smoke" parent="Spaceship" instance=ExtResource("5")] -transform = Transform3D(-0.268486, 0.87273, 0.407749, -0.097721, 0.396431, -0.912849, -0.958314, -0.284933, -0.0211522, -2.43791, 2.20846, -1.00656) +transform = Transform3D(-0.268486, 0.87273, 0.407749, -0.0977209, 0.396431, -0.912849, -0.958314, -0.284933, -0.0211522, -2.43791, 2.20846, -1.00656) skeleton = NodePath("") [node name="SpaceshipArea" type="Area3D" parent="Spaceship"] diff --git a/project.godot b/project.godot index 071854bd..70527de5 100644 --- a/project.godot +++ b/project.godot @@ -27,43 +27,6 @@ GameState="*res://autoload/game_state.tscn" Hotkeys="*res://autoload/hotkeys.gd" Utils="*res://autoload/utils.gd" -[dialogic] - -editor/character_preview_mode=0 -editor/current_editor=&"Timeline Editor" -editor/current_resources={ -"Character Editor": "res://dialogic/characters/player.dch", -"Timeline Editor": "res://dialogic/timelines/intro.dtl" -} -animations/join_default_length=0.5 -animations/leave_default_length=0.5 -animations/leave_default_wait=true -animations/join_default_wait=true -choices/autofocus_first=true -choices/delay=0.2 -text/speed=0.038 -text/skippable=true -text/autocontinue_delay=1.0 -history/history_system=false -history/full_history=true -history/text_history=true -save/autosave_delay=60.0 -variables={} -glossary/default_case_sensitive=true -layout/mode=0 -editor/current_timeline_path="res://dialogic/timelines/broken_spaceship.dtl" -editor/timeline_editor_mode=0 -editor/last/resources=["res://dialogic/timelines/broken_spaceship.dtl", "res://dialogic/timelines/intro.dtl"] -editor/visual_timeline_editor_sidebar=200.0 -layout/export_overrides={ -"box_modulate": "Color(0.00784314, 0.00784314, 0.00784314, 0.705882)", -"name_label_box_modulate": "Color(0.00784314, 0.00784314, 0.00784314, 0.705882)", -"name_label_font_size": "24.0", -"text_size": "24.0" -} -layout_scene="res://addons/dialogic/Events/DefaultLayouts/Default/DialogicDefaultLayout.tscn" -editor/custom_testing_layout="res://addons/dialogic/Events/DefaultLayouts/Default/DialogicDefaultLayout.tscn" - [display] window/size/viewport_width=1280 diff --git a/props/godot_head/godot_head.gd b/props/godot_head/godot_head.gd index c0c9f75d..10e03473 100644 --- a/props/godot_head/godot_head.gd +++ b/props/godot_head/godot_head.gd @@ -10,7 +10,7 @@ func _ready() -> void: queue_free() func _on_GodotPowerUp_body_entered(_body: Node) -> void: - if !collected: + if !collected and visible: collected = true GameState.collect_godot_head(owner.name, name) $AudioStreamPlayer.play() diff --git a/ui/dialog.gd b/ui/dialog.gd index 09b7a0c8..503e176e 100644 --- a/ui/dialog.gd +++ b/ui/dialog.gd @@ -51,4 +51,5 @@ func close_dialog() -> void: hide() GameState.minimap.show() GameState.Player.paused = false + emit_signal("finished") )