diff --git a/Cutscenes/prototype_clone_victory.tres b/Cutscenes/prototype_clone_victory.tres index b0a0f4f..4d29cf1 100644 --- a/Cutscenes/prototype_clone_victory.tres +++ b/Cutscenes/prototype_clone_victory.tres @@ -1,4 +1,4 @@ -[gd_resource type="Resource" script_class="Cutscene" load_steps=35 format=3 uid="uid://ck75kipijh0fn"] +[gd_resource type="Resource" script_class="Cutscene" load_steps=38 format=3 uid="uid://ck75kipijh0fn"] [ext_resource type="Script" path="res://Scripts/Cutscenes/cutscene.gd" id="1_75ljw"] [ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/emit_message.gd" id="1_wfaj3"] @@ -9,6 +9,7 @@ [ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/move_character.gd" id="6_aee84"] [ext_resource type="AudioStream" uid="uid://jlr3b1nye15g" path="res://Audio/BGM/olympus_combat.mp3" id="7_4jbtj"] [ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/lookat_character.gd" id="7_gjmti"] +[ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/move_camera.gd" id="8_w0so3"] [sub_resource type="Resource" id="Resource_jm5v6"] script = ExtResource("1_wfaj3") @@ -57,8 +58,8 @@ textbox_direction = 1 [sub_resource type="Resource" id="Resource_ork8h"] script = ExtResource("7_gjmti") -character = NodePath("HiroPlayer") -lookat_target = NodePath("ReedAI") +character = NodePath("../HiroPlayer") +lookat_target = NodePath("../ReedAI") [sub_resource type="Resource" id="Resource_5axwh"] script = ExtResource("3_0uw7j") @@ -134,6 +135,16 @@ portrait_emotion = "normal" messages = Array[String](["Yeah! Don't hold anything back!", "Let's give this crowd a good show!"]) textbox_direction = 1 +[sub_resource type="Resource" id="Resource_wtu3y"] +script = ExtResource("8_w0so3") +target_camera = NodePath("../HiroPlayer/Camera2D") +to_initial = null +target = Vector2(0, -60) +relative = false +speed = 1.0 +teleport = false +wait_until_completion = true + [sub_resource type="Resource" id="Resource_hs1wh"] script = ExtResource("3_0uw7j") character = 4 @@ -161,6 +172,16 @@ portrait_emotion = "normal" messages = Array[String](["Fighters! All set?"]) textbox_direction = 1 +[sub_resource type="Resource" id="Resource_lafmq"] +script = ExtResource("8_w0so3") +target_camera = NodePath("../HiroPlayer/Camera2D") +to_initial = true +target = Vector2(0, -12) +relative = true +speed = 1.0 +teleport = false +wait_until_completion = true + [sub_resource type="Resource" id="Resource_v7db0"] script = ExtResource("3_0uw7j") character = 1 @@ -187,5 +208,5 @@ crossfade = true [resource] resource_name = "prototype_clone_defeated" script = ExtResource("1_75ljw") -commands = Array[Resource("res://Scripts/Cutscenes/Commands/base.gd")]([SubResource("Resource_jm5v6"), SubResource("Resource_as31p"), SubResource("Resource_xcdd6"), SubResource("Resource_bagm4"), SubResource("Resource_v16hg"), SubResource("Resource_vu1m2"), SubResource("Resource_4u6io"), SubResource("Resource_ork8h"), SubResource("Resource_5axwh"), SubResource("Resource_jdwa3"), SubResource("Resource_wsgt4"), SubResource("Resource_p2wwu"), SubResource("Resource_ben6d"), SubResource("Resource_5fw3k"), SubResource("Resource_t0ilw"), SubResource("Resource_3k148"), SubResource("Resource_f6433"), SubResource("Resource_o6ly6"), SubResource("Resource_pu4kf"), SubResource("Resource_hs1wh"), SubResource("Resource_apw73"), SubResource("Resource_yt0uq"), SubResource("Resource_v7db0"), SubResource("Resource_p8wvt"), SubResource("Resource_tjwhc")]) +commands = Array[Resource("res://Scripts/Cutscenes/Commands/base.gd")]([SubResource("Resource_jm5v6"), SubResource("Resource_as31p"), SubResource("Resource_xcdd6"), SubResource("Resource_bagm4"), SubResource("Resource_v16hg"), SubResource("Resource_vu1m2"), SubResource("Resource_4u6io"), SubResource("Resource_ork8h"), SubResource("Resource_5axwh"), SubResource("Resource_jdwa3"), SubResource("Resource_wsgt4"), SubResource("Resource_p2wwu"), SubResource("Resource_ben6d"), SubResource("Resource_5fw3k"), SubResource("Resource_t0ilw"), SubResource("Resource_3k148"), SubResource("Resource_f6433"), SubResource("Resource_o6ly6"), SubResource("Resource_pu4kf"), SubResource("Resource_wtu3y"), SubResource("Resource_hs1wh"), SubResource("Resource_apw73"), SubResource("Resource_yt0uq"), SubResource("Resource_lafmq"), SubResource("Resource_v7db0"), SubResource("Resource_p8wvt"), SubResource("Resource_tjwhc")]) auto_start_on_load = true diff --git a/Cutscenes/prototype_talk_to_nem.tres b/Cutscenes/prototype_talk_to_nem.tres index b2b17c6..88de21a 100644 --- a/Cutscenes/prototype_talk_to_nem.tres +++ b/Cutscenes/prototype_talk_to_nem.tres @@ -1,9 +1,10 @@ -[gd_resource type="Resource" script_class="Cutscene" load_steps=37 format=3 uid="uid://ck0ry5vxaj8a7"] +[gd_resource type="Resource" script_class="Cutscene" load_steps=40 format=3 uid="uid://ck0ry5vxaj8a7"] [ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/lookat_character.gd" id="1_ri0w6"] [ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/show_dialogue.gd" id="2_c1bel"] [ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/move_character.gd" id="3_7tq4l"] [ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/turn_character.gd" id="4_fur8q"] +[ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/move_camera.gd" id="5_15rwr"] [ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/wait.gd" id="5_oj3jh"] [ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/emit_message.gd" id="5_t1lmo"] [ext_resource type="Script" path="res://Scripts/Cutscenes/cutscene.gd" id="5_wqnqw"] @@ -71,6 +72,16 @@ portrait_emotion = "normal" messages = Array[String](["All I have to do is summon my shadow clone!"]) textbox_direction = 0 +[sub_resource type="Resource" id="Resource_8188r"] +script = ExtResource("5_15rwr") +target_camera = NodePath("../HiroPlayer/Camera2D") +to_initial = false +target = Vector2(0, 0) +relative = false +speed = 1.0 +teleport = false +wait_until_completion = true + [sub_resource type="Resource" id="Resource_83rs0"] script = ExtResource("5_t1lmo") message = &"show_clone" @@ -211,8 +222,18 @@ script = ExtResource("8_5d7q1") music = ExtResource("7_wgiee") crossfade = true +[sub_resource type="Resource" id="Resource_uibnf"] +script = ExtResource("5_15rwr") +target_camera = NodePath("../HiroPlayer/Camera2D") +to_initial = true +target = Vector2(0, -12) +relative = true +speed = 1.5 +teleport = false +wait_until_completion = true + [resource] resource_name = "talking_to_nem" script = ExtResource("5_wqnqw") -commands = Array[Resource("res://Scripts/Cutscenes/Commands/base.gd")]([SubResource("Resource_de27e"), SubResource("Resource_3bkhm"), SubResource("Resource_tgajv"), SubResource("Resource_qi6iy"), SubResource("Resource_775qe"), SubResource("Resource_yaf72"), SubResource("Resource_h8br4"), SubResource("Resource_0c4lk"), SubResource("Resource_83rs0"), SubResource("Resource_blakn"), SubResource("Resource_r5wd6"), SubResource("Resource_slop4"), SubResource("Resource_h3k50"), SubResource("Resource_wo7y2"), SubResource("Resource_hi1ck"), SubResource("Resource_5ci1l"), SubResource("Resource_abui6"), SubResource("Resource_kb8r5"), SubResource("Resource_8xfaf"), SubResource("Resource_4iw0f"), SubResource("Resource_kd0jj"), SubResource("Resource_w7l1e"), SubResource("Resource_7url7"), SubResource("Resource_efygu"), SubResource("Resource_u7g7o"), SubResource("Resource_ujwnf"), SubResource("Resource_ts1m3")]) +commands = Array[Resource("res://Scripts/Cutscenes/Commands/base.gd")]([SubResource("Resource_de27e"), SubResource("Resource_3bkhm"), SubResource("Resource_tgajv"), SubResource("Resource_qi6iy"), SubResource("Resource_775qe"), SubResource("Resource_yaf72"), SubResource("Resource_h8br4"), SubResource("Resource_0c4lk"), SubResource("Resource_8188r"), SubResource("Resource_83rs0"), SubResource("Resource_blakn"), SubResource("Resource_r5wd6"), SubResource("Resource_slop4"), SubResource("Resource_h3k50"), SubResource("Resource_wo7y2"), SubResource("Resource_hi1ck"), SubResource("Resource_5ci1l"), SubResource("Resource_abui6"), SubResource("Resource_kb8r5"), SubResource("Resource_8xfaf"), SubResource("Resource_4iw0f"), SubResource("Resource_kd0jj"), SubResource("Resource_w7l1e"), SubResource("Resource_7url7"), SubResource("Resource_efygu"), SubResource("Resource_u7g7o"), SubResource("Resource_ujwnf"), SubResource("Resource_ts1m3"), SubResource("Resource_uibnf")]) auto_start_on_load = true diff --git a/Scripts/Cutscenes/Commands/move_camera.gd b/Scripts/Cutscenes/Commands/move_camera.gd new file mode 100644 index 0000000..c78169e --- /dev/null +++ b/Scripts/Cutscenes/Commands/move_camera.gd @@ -0,0 +1,21 @@ +@tool +class_name MoveCameraCommand extends CutsceneCommand + +@export_node_path("LerpableCamera") var target_camera: NodePath +@export var to_initial = false +@export var target: Vector2 +@export var relative = false +@export var speed = 1.0 +@export var teleport = false +@export var wait_until_completion = true + +func _validate_property(property: Dictionary): + if property.name == "speed" and teleport: + property.usage |= PROPERTY_USAGE_READ_ONLY + elif property.name == "speed" and not teleport: + property.usage &= ~PROPERTY_USAGE_READ_ONLY + + if (property.name == "target" or property.name == "relative") and to_initial: + property.usage |= PROPERTY_USAGE_READ_ONLY + elif (property.name == "target" or property.name == "relative") and not to_initial: + property.usage &= ~PROPERTY_USAGE_READ_ONLY diff --git a/Scripts/Levels/arena_level.gd b/Scripts/Levels/arena_level.gd index 2f5f7f0..ff63794 100644 --- a/Scripts/Levels/arena_level.gd +++ b/Scripts/Levels/arena_level.gd @@ -66,6 +66,19 @@ func _on_cutscene_manager_issued_command(command: CutsceneCommand, manager: Cuts assert(character is CharacterBase) character.set_animation_direction(face_direction) manager.step() + elif command is MoveCameraCommand: + var camera: LerpableCamera = manager.root.get_node(command.target_camera) + var target_position = camera.focus_starting_position if command.to_initial else command.target + var relative = true if command.to_initial else command.relative + if command.teleport: + camera.teleport_to(target_position, relative) + manager.step() + else: + camera.lerp_to(target_position, relative, command.speed) + if command.wait_until_completion: + camera.move_completed.connect(manager.step, CONNECT_ONE_SHOT) + else: + manager.step() elif command is EmitMessageCommand: if command.message == "show_clone": hiro_ai.global_position = $PositionMarkers/Marker3.global_position diff --git a/Scripts/lerping_camera.gd b/Scripts/lerping_camera.gd new file mode 100644 index 0000000..199f732 --- /dev/null +++ b/Scripts/lerping_camera.gd @@ -0,0 +1,34 @@ +class_name LerpableCamera extends Camera2D + +signal move_completed + +@export var focus_starting_position: Vector2 = Vector2(0.0, -12.0) +var lerp_speed = 1.0 +var focus_start = focus_starting_position +var focus_target = focus_starting_position +var t = 0.0 + +func _ready(): + offset = focus_starting_position + +func _process(delta): + if focus_start != focus_target and t < 1.0: + t += lerp_speed * delta + var smooth_t = smoothstep(0.0, 1.0, t) + offset = lerp(focus_start, focus_target, smooth_t) + if focus_start == focus_target or t >= 1.0: + offset = focus_target + focus_start = focus_target + move_completed.emit() + +func lerp_to(point: Vector2, relative = false, speed = 1.0): + focus_start = offset + focus_target = point if relative else point - (global_position - focus_starting_position) + t = 0.0 + lerp_speed = speed + +func teleport_to(point: Vector2, relative = false): + t = 1.0 + offset = point if relative else point - (global_position - focus_starting_position) + focus_target = offset + focus_start = focus_target diff --git a/world/world.tscn b/world/world.tscn index e59e0a3..f40899a 100644 --- a/world/world.tscn +++ b/world/world.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=38 format=3 uid="uid://bxuxjqxxqy7ce"] +[gd_scene load_steps=39 format=3 uid="uid://bxuxjqxxqy7ce"] [ext_resource type="PackedScene" uid="uid://di21xheryhp0k" path="res://Hiro/hiro_player.tscn" id="1_c1gpq"] [ext_resource type="PackedScene" uid="uid://b8sfype1vx5ad" path="res://Nem/nem_npc.tscn" id="1_sqt7d"] @@ -19,6 +19,7 @@ [ext_resource type="Texture2D" uid="uid://y31qyw51y7hb" path="res://NPCs/npc3.png" id="13_6g4gt"] [ext_resource type="Texture2D" uid="uid://jnub86bpiebw" path="res://NPCs/npc4.png" id="14_46hs3"] [ext_resource type="Texture2D" uid="uid://baw6gijyxv1fv" path="res://NPCs/npc5.png" id="15_ppm1i"] +[ext_resource type="Script" path="res://Scripts/lerping_camera.gd" id="16_6jycw"] [ext_resource type="Texture2D" uid="uid://bcvxfjlg8mmjr" path="res://NPCs/npc6.png" id="16_cgyrp"] [ext_resource type="Script" path="res://Scripts/Cutscenes/manager.gd" id="19_5yvrq"] [ext_resource type="PackedScene" uid="uid://bwrwh5of0jw4a" path="res://Reed/reed_ai.tscn" id="21_dioix"] @@ -276,11 +277,10 @@ has_nsfw_animations = false [node name="Camera2D" type="Camera2D" parent="HiroPlayer"] texture_filter = 1 -offset = Vector2(0, -12) zoom = Vector2(3, 3) position_smoothing_enabled = true position_smoothing_speed = 3.0 -metadata/_edit_lock_ = true +script = ExtResource("16_6jycw") [node name="NemNPC" parent="." instance=ExtResource("1_sqt7d")] position = Vector2(2, -78)