Compare commits

..

No commits in common. "main" and "feature/rituals" have entirely different histories.

62 changed files with 228 additions and 1159 deletions

View file

@ -1,5 +0,0 @@
extends Area2D
func _unhandled_input(event):
#get_viewport().set_input_as_handled()
pass

View file

@ -1 +0,0 @@
uid://cpyqpaggaiqb4

View file

@ -1,28 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://c2cgr4eqpyahm"]
[ext_resource type="PackedScene" uid="uid://3oqyqft8w72m" path="res://selectable.tscn" id="1_uk0nh"]
[sub_resource type="Gradient" id="Gradient_fq5io"]
offsets = PackedFloat32Array(0.272085)
colors = PackedColorArray(0.202521, 0.371426, 0.429081, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_ty4ro"]
gradient = SubResource("Gradient_fq5io")
width = 100
height = 200
fill_from = Vector2(0.5, 0)
fill_to = Vector2(0.5, 1)
[node name="Bob" type="Sprite2D"]
texture = SubResource("GradientTexture2D_ty4ro")
[node name="Selectable" parent="." instance=ExtResource("1_uk0nh")]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Selectable"]
polygon = PackedVector2Array(-50, 100, -50, -100, 50, -100, 50, 100)
[node name="Label" type="Label" parent="."]
offset_top = 2.0
offset_right = 40.0
offset_bottom = 25.0
text = "Bob"

View file

@ -1,18 +1,15 @@
class_name DialogBob
class_name Dialog
extends Node2D
signal dialog_finished(choice_selected: String)
const SPEED_SLOW = 10.0
const SPEED_NORMAL = 15.0
const SPEED_FAST = 20.0
@export var test: Array[DialogLine] = []
signal dialog_finished
var text_box_label: RichTextLabel
const SPEED_SLOW = 5.0
const SPEED_NORMAL = 10.0
const SPEED_FAST = 15.0
var dialog_text: Array[Dictionary] = [
{speaker = "?", text = "...", speed = SPEED_SLOW},
@ -28,27 +25,19 @@ var dialog_text: Array[Dictionary] = [
var current_line = 0
func _ready():
text_box_label.visible = true
text_box_label.text = ""
$Undead.modulate = Color(1.0,1.0,1.0,0)
next_line()
func _unhandled_input(event):
if event is InputEventKey:
if event.key_label == KEY_SPACE and event.is_released():
next_line()
func _input(event):
if event is InputEventKey and event.key_label == KEY_SPACE and event.is_released():
next_line()
var tween: Tween
func next_line():
if not text_box_label.visible: return
if tween:
if tween.is_running():
tween.pause()
tween.custom_step(20)
return
tween.kill()
if current_line >= dialog_text.size():
dialog_finished.emit("")
dialog_finished.emit()
text_box_label.hide()
return
if current_line == 0:
@ -64,7 +53,8 @@ func next_line():
text_box_label.visible_characters = next["speaker"].length() + 2
var remaining_characters = text_box_label.text.length() - text_box_label.visible_characters
var tween_duration = remaining_characters / (next["speed"] if next.has("speed") else SPEED_NORMAL)
if tween:
tween.kill()
tween = create_tween()
tween.tween_property(text_box_label, "visible_characters", text_box_label.text.length(), tween_duration)
current_line += 1

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=6 format=3 uid="uid://4yxpfr8xhlu1"]
[ext_resource type="Script" uid="uid://cqhmuhb0je7f1" path="res://dialog/dialog_bob.gd" id="1_1x3pg"]
[ext_resource type="Script" uid="uid://cqhmuhb0je7f1" path="res://dialog.gd" id="1_7voku"]
[sub_resource type="Gradient" id="Gradient_cuqb1"]
offsets = PackedFloat32Array(0)
@ -22,7 +22,7 @@ fill_from = Vector2(0.5, 0)
fill_to = Vector2(0.5, 1)
[node name="Dialog" type="Node2D"]
script = ExtResource("1_1x3pg")
script = ExtResource("1_7voku")
[node name="BlackBackground" type="Sprite2D" parent="."]
position = Vector2(576, 325.25)

View file

@ -1,13 +0,0 @@
class_name DialogLine
extends Resource
enum Speed {SLOW = 5, NORMAL = 10, FAST = 15}
@export var speaker: String
@export var text: String
@export var speed: Speed
func _init(p_speaker = "<unset>", p_text = "<unset>", p_speed = Speed.NORMAL):
speaker = p_speaker
text = p_text
speed = p_speed

View file

@ -1 +0,0 @@
uid://bobf7358b6rqc

View file

@ -1,9 +0,0 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://gpeevcuiad3r"]
[ext_resource type="Script" uid="uid://bobf7358b6rqc" path="res://dialog/dialog_line.gd" id="1_2fsj5"]
[resource]
script = ExtResource("1_2fsj5")
speaker = ""
text = ""
speed = 0

View file

@ -1,113 +0,0 @@
class_name DialogMap
extends Node2D
signal dialog_finished(choice_selected: String)
const SPEED_SLOW = 10.0
const SPEED_NORMAL = 15.0
const SPEED_FAST = 20.0
@export var map_point_number = 0
var text_box_label: RichTextLabel
var choice_1_button: Button
var choice_2_button: Button
var dialog_text: Array[Dictionary]
var current_line = 0
var is_choice_needed = false
func _ready():
_setup_text()
text_box_label.visible = true
text_box_label.text = ""
choice_1_button.visible = false
choice_2_button.visible = false
next_line()
func _close_dialog(choice_selected: String = ""):
dialog_finished.emit(choice_selected)
text_box_label.text = ""
text_box_label.hide()
choice_1_button.hide()
choice_2_button.hide()
is_choice_needed = false
func _setup_text():
match map_point_number:
0:
dialog_text = [
{speaker = "Necra", text = "A small path leads away from the crypt."},
{speaker = "Necra", text = "I follow it slowly into the dark forest."},
{speaker = "Necra", text = "After some time on the path I see a strange tree in full blossom."},
{speaker = "Necra", text = "Strange, everything else seems dead and decaying."},
{speaker = "Necra", text = "But this tree with it's blood red foliage defies the rest."},
{speaker = "Necra", text = "I notice a body sitting on the ground, laying against the massive stem amongs the tentacle like roots."},
{speaker = "Necra", text = "What should I do?", choices = ["Approach body", "Go back"]},
]
1:
dialog_text = [
{speaker = "Necra", text = "The path continues leading me away from the tree."},
{speaker = "Necra", text = "It gets less muddy and eventually turns into a poorly maintained brick road."},
{speaker = "Necra", text = "The road ends at a tower."},
{speaker = "Necra", text = "Something is dangling from the roof, it's hard to make out through the tree tops."},
{speaker = "Necra", text = "I can either go up to the rooftop, or continue deeper into the woods."},
]
2:
dialog_text = [
{speaker = "Necra", text = "I enter the tower ruins."},
{speaker = "Necra", text = "A stone staircase leads up the side of the small room."},
{speaker = "Necra", text = "I have to be careful climbing up, some stairs are missing."},
{speaker = "Necra", text = "On the roof I see an old wooden construct, a rope attached to it."},
{speaker = "Necra", text = "The rope holds a body at the neck over the steep descend."},
{speaker = "Necra", text = "Branches of dead trees seem to stretch toward it, trying to reach it desperately."},
]
3:
dialog_text = [
{speaker = "Necra", text = "The forest is way harder to pass now, without a discernible path."},
{speaker = "Necra", text = "I need all my strength to fight through the undergrowth."},
{speaker = "Necra", text = "Suddenly it clears into a small glade."},
{speaker = "Necra", text = "A headless body lies in the middle."},
]
var tween: Tween
func _unhandled_input(event):
if event is InputEventKey and event.key_label == KEY_SPACE and event.is_released():
if tween:
if tween.is_running():
tween.pause()
tween.custom_step(20)
return
tween.kill()
if not is_choice_needed:
next_line()
func next_line():
if not text_box_label.visible: return
if current_line >= dialog_text.size():
_close_dialog()
return
var next = dialog_text[current_line]
text_box_label.text = "%s: %s" % [next["speaker"], next["text"]]
text_box_label.visible_characters = next["speaker"].length() + 2
var remaining_characters = text_box_label.text.length() - text_box_label.visible_characters
var tween_duration = remaining_characters / (next["speed"] if next.has("speed") else SPEED_NORMAL)
tween = create_tween()
tween.tween_property(text_box_label, "visible_characters", text_box_label.text.length(), tween_duration)
if "choices" in next:
is_choice_needed = true
tween.tween_callback(_show_choices.bind(next["choices"]))
current_line += 1
func _show_choices(choices: Array):
choice_1_button.text = choices[0]
choice_1_button.visible = true
choice_1_button.pressed.connect(_close_dialog.bind(choices[0]))
choice_2_button.text = choices[1]
choice_2_button.visible = true
choice_2_button.pressed.connect(_close_dialog.bind(choices[1]))
is_choice_needed = true

View file

@ -1 +0,0 @@
uid://1etg7jqmrawe

View file

@ -1,19 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://t74021gpv6sg"]
[ext_resource type="Script" uid="uid://1etg7jqmrawe" path="res://dialog/dialog_map.gd" id="1_f0ess"]
[sub_resource type="Gradient" id="Gradient_cuqb1"]
offsets = PackedFloat32Array(0)
colors = PackedColorArray(0, 0, 0, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_30ci2"]
gradient = SubResource("Gradient_cuqb1")
width = 1152
[node name="Dialog" type="Node2D"]
script = ExtResource("1_f0ess")
[node name="BlackBackground" type="Sprite2D" parent="."]
position = Vector2(576, 325.25)
scale = Vector2(1.001, 652)
texture = SubResource("GradientTexture1D_30ci2")

View file

@ -1,18 +0,0 @@
class_name DropoffArea
extends Area2D
func _on_area_entered(area):
if area is not PickupArea: return
(area as PickupArea).dropped.connect(_on_pickup_area_dropped.bind(area))
func _on_area_exited(area):
if area is not PickupArea: return
(area as PickupArea).dropped.disconnect(_on_pickup_area_dropped)
func _on_pickup_area_dropped(pickup_area: PickupArea):
pickup_area.parent.reparent(get_parent())

View file

@ -1 +0,0 @@
uid://bpotohrm5j8tm

View file

@ -1,11 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://cnq1uvadx0rwf"]
[ext_resource type="Script" uid="uid://bpotohrm5j8tm" path="res://dropoff_area.gd" id="1_uu3dj"]
[node name="DropoffArea" type="Area2D"]
collision_layer = 2
collision_mask = 2
script = ExtResource("1_uu3dj")
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
[connection signal="area_exited" from="." to="." method="_on_area_exited"]

View file

@ -1,295 +0,0 @@
[preset.0]
name="macOS"
platform="macOS"
runnable=true
advanced_options=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="out/necra_prototype_macos.zip"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.0.options]
export/distribution_type=0
binary_format/architecture="universal"
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
application/icon=""
application/icon_interpolation=4
application/bundle_identifier="antonioda.necra"
application/signature=""
application/app_category="Games"
application/short_version=""
application/version=""
application/copyright=""
application/copyright_localized={}
application/min_macos_version_x86_64="10.12"
application/min_macos_version_arm64="11.00"
application/export_angle=0
display/high_res=true
application/additional_plist_content=""
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/entitlements/custom_file=""
codesign/entitlements/allow_jit_code_execution=false
codesign/entitlements/allow_unsigned_executable_memory=false
codesign/entitlements/allow_dyld_environment_variables=false
codesign/entitlements/disable_library_validation=false
codesign/entitlements/audio_input=false
codesign/entitlements/camera=false
codesign/entitlements/location=false
codesign/entitlements/address_book=false
codesign/entitlements/calendars=false
codesign/entitlements/photos_library=false
codesign/entitlements/apple_events=false
codesign/entitlements/debugging=false
codesign/entitlements/app_sandbox/enabled=false
codesign/entitlements/app_sandbox/network_server=false
codesign/entitlements/app_sandbox/network_client=false
codesign/entitlements/app_sandbox/device_usb=false
codesign/entitlements/app_sandbox/device_bluetooth=false
codesign/entitlements/app_sandbox/files_downloads=0
codesign/entitlements/app_sandbox/files_pictures=0
codesign/entitlements/app_sandbox/files_music=0
codesign/entitlements/app_sandbox/files_movies=0
codesign/entitlements/app_sandbox/files_user_selected=0
codesign/entitlements/app_sandbox/helper_executables=[]
codesign/entitlements/additional=""
codesign/custom_options=PackedStringArray()
notarization/notarization=0
privacy/microphone_usage_description=""
privacy/microphone_usage_description_localized={}
privacy/camera_usage_description=""
privacy/camera_usage_description_localized={}
privacy/location_usage_description=""
privacy/location_usage_description_localized={}
privacy/address_book_usage_description=""
privacy/address_book_usage_description_localized={}
privacy/calendar_usage_description=""
privacy/calendar_usage_description_localized={}
privacy/photos_library_usage_description=""
privacy/photos_library_usage_description_localized={}
privacy/desktop_folder_usage_description=""
privacy/desktop_folder_usage_description_localized={}
privacy/documents_folder_usage_description=""
privacy/documents_folder_usage_description_localized={}
privacy/downloads_folder_usage_description=""
privacy/downloads_folder_usage_description_localized={}
privacy/network_volumes_usage_description=""
privacy/network_volumes_usage_description_localized={}
privacy/removable_volumes_usage_description=""
privacy/removable_volumes_usage_description_localized={}
privacy/tracking_enabled=false
privacy/tracking_domains=PackedStringArray()
privacy/collected_data/name/collected=false
privacy/collected_data/name/linked_to_user=false
privacy/collected_data/name/used_for_tracking=false
privacy/collected_data/name/collection_purposes=0
privacy/collected_data/email_address/collected=false
privacy/collected_data/email_address/linked_to_user=false
privacy/collected_data/email_address/used_for_tracking=false
privacy/collected_data/email_address/collection_purposes=0
privacy/collected_data/phone_number/collected=false
privacy/collected_data/phone_number/linked_to_user=false
privacy/collected_data/phone_number/used_for_tracking=false
privacy/collected_data/phone_number/collection_purposes=0
privacy/collected_data/physical_address/collected=false
privacy/collected_data/physical_address/linked_to_user=false
privacy/collected_data/physical_address/used_for_tracking=false
privacy/collected_data/physical_address/collection_purposes=0
privacy/collected_data/other_contact_info/collected=false
privacy/collected_data/other_contact_info/linked_to_user=false
privacy/collected_data/other_contact_info/used_for_tracking=false
privacy/collected_data/other_contact_info/collection_purposes=0
privacy/collected_data/health/collected=false
privacy/collected_data/health/linked_to_user=false
privacy/collected_data/health/used_for_tracking=false
privacy/collected_data/health/collection_purposes=0
privacy/collected_data/fitness/collected=false
privacy/collected_data/fitness/linked_to_user=false
privacy/collected_data/fitness/used_for_tracking=false
privacy/collected_data/fitness/collection_purposes=0
privacy/collected_data/payment_info/collected=false
privacy/collected_data/payment_info/linked_to_user=false
privacy/collected_data/payment_info/used_for_tracking=false
privacy/collected_data/payment_info/collection_purposes=0
privacy/collected_data/credit_info/collected=false
privacy/collected_data/credit_info/linked_to_user=false
privacy/collected_data/credit_info/used_for_tracking=false
privacy/collected_data/credit_info/collection_purposes=0
privacy/collected_data/other_financial_info/collected=false
privacy/collected_data/other_financial_info/linked_to_user=false
privacy/collected_data/other_financial_info/used_for_tracking=false
privacy/collected_data/other_financial_info/collection_purposes=0
privacy/collected_data/precise_location/collected=false
privacy/collected_data/precise_location/linked_to_user=false
privacy/collected_data/precise_location/used_for_tracking=false
privacy/collected_data/precise_location/collection_purposes=0
privacy/collected_data/coarse_location/collected=false
privacy/collected_data/coarse_location/linked_to_user=false
privacy/collected_data/coarse_location/used_for_tracking=false
privacy/collected_data/coarse_location/collection_purposes=0
privacy/collected_data/sensitive_info/collected=false
privacy/collected_data/sensitive_info/linked_to_user=false
privacy/collected_data/sensitive_info/used_for_tracking=false
privacy/collected_data/sensitive_info/collection_purposes=0
privacy/collected_data/contacts/collected=false
privacy/collected_data/contacts/linked_to_user=false
privacy/collected_data/contacts/used_for_tracking=false
privacy/collected_data/contacts/collection_purposes=0
privacy/collected_data/emails_or_text_messages/collected=false
privacy/collected_data/emails_or_text_messages/linked_to_user=false
privacy/collected_data/emails_or_text_messages/used_for_tracking=false
privacy/collected_data/emails_or_text_messages/collection_purposes=0
privacy/collected_data/photos_or_videos/collected=false
privacy/collected_data/photos_or_videos/linked_to_user=false
privacy/collected_data/photos_or_videos/used_for_tracking=false
privacy/collected_data/photos_or_videos/collection_purposes=0
privacy/collected_data/audio_data/collected=false
privacy/collected_data/audio_data/linked_to_user=false
privacy/collected_data/audio_data/used_for_tracking=false
privacy/collected_data/audio_data/collection_purposes=0
privacy/collected_data/gameplay_content/collected=false
privacy/collected_data/gameplay_content/linked_to_user=false
privacy/collected_data/gameplay_content/used_for_tracking=false
privacy/collected_data/gameplay_content/collection_purposes=0
privacy/collected_data/customer_support/collected=false
privacy/collected_data/customer_support/linked_to_user=false
privacy/collected_data/customer_support/used_for_tracking=false
privacy/collected_data/customer_support/collection_purposes=0
privacy/collected_data/other_user_content/collected=false
privacy/collected_data/other_user_content/linked_to_user=false
privacy/collected_data/other_user_content/used_for_tracking=false
privacy/collected_data/other_user_content/collection_purposes=0
privacy/collected_data/browsing_history/collected=false
privacy/collected_data/browsing_history/linked_to_user=false
privacy/collected_data/browsing_history/used_for_tracking=false
privacy/collected_data/browsing_history/collection_purposes=0
privacy/collected_data/search_hhistory/collected=false
privacy/collected_data/search_hhistory/linked_to_user=false
privacy/collected_data/search_hhistory/used_for_tracking=false
privacy/collected_data/search_hhistory/collection_purposes=0
privacy/collected_data/user_id/collected=false
privacy/collected_data/user_id/linked_to_user=false
privacy/collected_data/user_id/used_for_tracking=false
privacy/collected_data/user_id/collection_purposes=0
privacy/collected_data/device_id/collected=false
privacy/collected_data/device_id/linked_to_user=false
privacy/collected_data/device_id/used_for_tracking=false
privacy/collected_data/device_id/collection_purposes=0
privacy/collected_data/purchase_history/collected=false
privacy/collected_data/purchase_history/linked_to_user=false
privacy/collected_data/purchase_history/used_for_tracking=false
privacy/collected_data/purchase_history/collection_purposes=0
privacy/collected_data/product_interaction/collected=false
privacy/collected_data/product_interaction/linked_to_user=false
privacy/collected_data/product_interaction/used_for_tracking=false
privacy/collected_data/product_interaction/collection_purposes=0
privacy/collected_data/advertising_data/collected=false
privacy/collected_data/advertising_data/linked_to_user=false
privacy/collected_data/advertising_data/used_for_tracking=false
privacy/collected_data/advertising_data/collection_purposes=0
privacy/collected_data/other_usage_data/collected=false
privacy/collected_data/other_usage_data/linked_to_user=false
privacy/collected_data/other_usage_data/used_for_tracking=false
privacy/collected_data/other_usage_data/collection_purposes=0
privacy/collected_data/crash_data/collected=false
privacy/collected_data/crash_data/linked_to_user=false
privacy/collected_data/crash_data/used_for_tracking=false
privacy/collected_data/crash_data/collection_purposes=0
privacy/collected_data/performance_data/collected=false
privacy/collected_data/performance_data/linked_to_user=false
privacy/collected_data/performance_data/used_for_tracking=false
privacy/collected_data/performance_data/collection_purposes=0
privacy/collected_data/other_diagnostic_data/collected=false
privacy/collected_data/other_diagnostic_data/linked_to_user=false
privacy/collected_data/other_diagnostic_data/used_for_tracking=false
privacy/collected_data/other_diagnostic_data/collection_purposes=0
privacy/collected_data/environment_scanning/collected=false
privacy/collected_data/environment_scanning/linked_to_user=false
privacy/collected_data/environment_scanning/used_for_tracking=false
privacy/collected_data/environment_scanning/collection_purposes=0
privacy/collected_data/hands/collected=false
privacy/collected_data/hands/linked_to_user=false
privacy/collected_data/hands/used_for_tracking=false
privacy/collected_data/hands/collection_purposes=0
privacy/collected_data/head/collected=false
privacy/collected_data/head/linked_to_user=false
privacy/collected_data/head/used_for_tracking=false
privacy/collected_data/head/collection_purposes=0
privacy/collected_data/other_data_types/collected=false
privacy/collected_data/other_data_types/linked_to_user=false
privacy/collected_data/other_data_types/used_for_tracking=false
privacy/collected_data/other_data_types/collection_purposes=0
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
open \"{temp_dir}/{exe_name}.app\" --args {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name}.app/Contents/MacOS/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""
[preset.1]
name="Linux"
platform="Linux"
runnable=true
advanced_options=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="out/necra_prototype_linux.x86_64"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.1.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""

View file

@ -30,7 +30,7 @@ var previous_offset: float:
previous_offset = new_value
incantation_text.colored_offset = previous_offset
func _unhandled_input(event):
func _input(event):
if is_incantation_completed: return
if event is InputEventMouseButton:

View file

@ -25,8 +25,3 @@ func _draw():
draw_set_transform(t.origin - (Vector2.UP * 5).rotated(t.get_rotation()), t.get_rotation())
draw_char(get_theme_default_font(), Vector2.ZERO, c, 16, Color.WHITE if offset >= colored_offset else Color.RED)
offset += 10
func _on_visibility_changed():
print("Test")
queue_redraw()

99
main.gd
View file

@ -1,44 +1,51 @@
extends Node2D
const DARK_CUT_SCENE = preload("res://operation/prototype_dark_cut.tscn")
const DIALOG_BOB_SCENE = preload("res://dialog/dialog_bob.tscn")
const MAP_SCENE = preload("res://map/prototype_map.tscn")
const DIALOG_SCENE = preload("res://dialog.tscn")
const RITUAL_BOOK_SCENE = preload("res://prototype_ritual_book.tscn")
@onready var room: Node2D = $Room
@onready var shelves: Node2D = $Shelves
var shown_map_points: Array[int] = [0]
var is_dialog_shown = false
var map_precondition: String:
set(new_value):
if map_precondition == "dark_cut_completed" and not new_value:
(get_node("PrototypeMap") as PrototypeMap).show_map_point([1])
map_precondition = new_value
func _ready():
_show_dialog()
func _on_dialog_finished(dialog: Dialog):
dialog.queue_free()
_enable_node2d(room)
_enable_node2d(shelves)
func _on_bob_clicked():
var dialog_bob = DIALOG_BOB_SCENE.instantiate()
_disable_node2d(room)
dialog_bob.dialog_finished.connect(func(choice):
_enable_node2d(room)
)
_show_dialog(dialog_bob)
_show_dialog()
func _show_dark_cut():
func _show_dialog():
_disable_node2d(room)
_disable_node2d(shelves)
var dialog = DIALOG_SCENE.instantiate()
dialog.dialog_finished.connect(_on_dialog_finished.bind(dialog))
dialog.text_box_label = %TextBoxLabel
add_child.call_deferred(dialog)
func _on_ritual_place_clicked():
_disable_node2d(room)
var dark_cut = DARK_CUT_SCENE.instantiate()
dark_cut.succeeded.connect(_on_dark_cut_succeeded.bind(dark_cut))
dark_cut.failed.connect(_on_dark_cut_failed.bind(dark_cut))
add_child.call_deferred(dark_cut)
move_child.call_deferred($Suitcase, -1)
func _on_map_selectable_clicked():
var map: PrototypeMap = MAP_SCENE.instantiate()
map.shown_points = shown_map_points
map.dialog_triggered.connect(_on_map_dialog_triggered.bind(map))
map.shown_points_changed.connect(func(value): shown_map_points = value)
map.map_closed.connect(_on_map_closed.bind(map))
add_child.call_deferred(map)
func _on_dark_cut_succeeded(dark_cut: DarkCut):
dark_cut.queue_free()
_show_room()
func _on_dark_cut_failed(dark_cut: DarkCut):
dark_cut.queue_free()
_show_room()
func _show_room():
_enable_node2d(room)
_enable_node2d(shelves)
func _disable_node2d(node: Node2D):
node.hide()
@ -48,46 +55,6 @@ func _enable_node2d(node: Node2D):
node.show()
node.set_deferred("process", true)
func _show_room():
_enable_node2d(room)
func _show_dialog(dialog):
if is_dialog_shown: return
is_dialog_shown = true
_disable_node2d(room)
dialog.dialog_finished.connect(_on_dialog_finished.bind(dialog))
dialog.text_box_label = %TextBoxLabel
if "choice_1_button" in dialog:
dialog.choice_1_button = %Choice1
if "choice_2_button" in dialog:
dialog.choice_2_button = %Choice2
add_child.call_deferred(dialog)
func _on_dark_cut_succeeded(dark_cut: DarkCut):
dark_cut.queue_free()
map_precondition = ""
_show_room()
func _on_dark_cut_failed(dark_cut: DarkCut):
dark_cut.queue_free()
_show_room()
func _on_dialog_finished(choice_selected: String, dialog: Node):
is_dialog_shown = false
dialog.queue_free()
_enable_node2d(room)
if choice_selected == "Approach body":
_show_dark_cut()
func _on_map_dialog_triggered(dialog_map: DialogMap, map_points_to_show: Array[int], precondition: String, map: PrototypeMap):
_show_dialog(dialog_map)
if not precondition:
map.show_map_point(map_points_to_show)
else:
map_precondition = precondition
func _on_map_closed(map: PrototypeMap):
map.queue_free()
_enable_node2d(room)
func _on_ritual_book_clicked():
pass # Replace with function body.

203
main.tscn
View file

@ -3,14 +3,16 @@
[ext_resource type="Script" uid="uid://lnmooufxbuym" path="res://main.gd" id="1_dp5o4"]
[ext_resource type="PackedScene" uid="uid://3oqyqft8w72m" path="res://selectable.tscn" id="3_g5hfc"]
[ext_resource type="Script" uid="uid://c3dlxuhruho8c" path="res://operation/feedback_canvas_modulate.gd" id="4_0odxb"]
[ext_resource type="PackedScene" uid="uid://cnq1uvadx0rwf" path="res://dropoff_area.tscn" id="4_ycdy4"]
[ext_resource type="PackedScene" uid="uid://bgp8l04mw4ddh" path="res://suitcase.tscn" id="12_dg77c"]
[ext_resource type="Texture2D" uid="uid://bicjfwpoa3pma" path="res://operation/test_table.png" id="5_lswn8"]
[ext_resource type="Script" uid="uid://ctpgjvo5g0sav" path="res://ritual_book.gd" id="12_ycdy4"]
[ext_resource type="PackedScene" uid="uid://qkwh186nbcya" path="res://prototype_ritual_book.tscn" id="13_ycdy4"]
[ext_resource type="Texture2D" uid="uid://ccy71gl4qatjy" path="res://operation/pliers.png" id="17_b1qrp"]
[ext_resource type="Script" uid="uid://crkr8emyhv1fo" path="res://operation/pliers.gd" id="18_come4"]
[ext_resource type="PackedScene" uid="uid://c3of67m4ic212" path="res://pickup_area.tscn" id="19_h8e4i"]
[ext_resource type="PackedScene" uid="uid://c3of67m4ic212" path="res://operation/pickup_area.tscn" id="19_h8e4i"]
[ext_resource type="Texture2D" uid="uid://cg3dg7iqif56d" path="res://operation/test_scalpel.png" id="20_4lmeg"]
[ext_resource type="Script" uid="uid://cqnproj5khm5a" path="res://operation/test_scalpel.gd" id="21_0cp0l"]
[ext_resource type="Shape2D" uid="uid://bo77ihhtxfueg" path="res://operation/scalpel_pickup_area_collision_shape.tres" id="22_d2t1y"]
[ext_resource type="Script" uid="uid://drfykuqe2phdt" path="res://operation/bat_dropoff.gd" id="23_gngh3"]
[sub_resource type="Gradient" id="Gradient_qkope"]
offsets = PackedFloat32Array(0.0372881)
@ -28,6 +30,17 @@ colors = PackedColorArray(0.281175, 0.300745, 0.258554, 1)
gradient = SubResource("Gradient_wb6aq")
width = 1152
[sub_resource type="Gradient" id="Gradient_fq5io"]
offsets = PackedFloat32Array(0.272085)
colors = PackedColorArray(0.202521, 0.371426, 0.429081, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_ty4ro"]
gradient = SubResource("Gradient_fq5io")
width = 100
height = 200
fill_from = Vector2(0.5, 0)
fill_to = Vector2(0.5, 1)
[sub_resource type="Gradient" id="Gradient_ncwe7"]
offsets = PackedFloat32Array(0.282686)
colors = PackedColorArray(0.368627, 0, 0, 1)
@ -56,15 +69,15 @@ height = 206.493
radius = 7.10071
height = 193.839
[sub_resource type="CircleShape2D" id="CircleShape2D_efxa6"]
radius = 8.24621
[sub_resource type="CircleShape2D" id="CircleShape2D_8w656"]
radius = 8.24621
[sub_resource type="CircleShape2D" id="CircleShape2D_qmwrh"]
radius = 5.65684
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0odxb"]
size = Vector2(110, 65)
[sub_resource type="Gradient" id="Gradient_vivmo"]
offsets = PackedFloat32Array(0.353357, 0.929329, 1)
colors = PackedColorArray(0, 0, 0, 1, 0.498233, 0.498233, 0.498233, 1, 1, 1, 1, 1)
@ -74,22 +87,6 @@ gradient = SubResource("Gradient_vivmo")
width = 32
height = 128
[sub_resource type="Gradient" id="Gradient_ycdy4"]
offsets = PackedFloat32Array(0.151943)
colors = PackedColorArray(0.19, 0.164287, 0.1368, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_w48qg"]
gradient = SubResource("Gradient_ycdy4")
width = 32
[sub_resource type="Gradient" id="Gradient_efxa6"]
offsets = PackedFloat32Array(0.116608)
colors = PackedColorArray(0.61, 0.527447, 0.4392, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_dg77c"]
gradient = SubResource("Gradient_efxa6")
width = 32
[node name="Main" type="Node2D"]
script = ExtResource("1_dp5o4")
@ -109,9 +106,9 @@ anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -353.0
offset_top = -68.0
offset_right = 353.0
offset_left = -259.0
offset_top = -33.0
offset_right = 259.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/margin_left = 5
@ -119,29 +116,10 @@ theme_override_constants/margin_top = 5
theme_override_constants/margin_right = 5
theme_override_constants/margin_bottom = 5
[node name="VBoxContainer" type="VBoxContainer" parent="UI/TextBox"]
layout_mode = 2
[node name="TextBoxLabel" type="RichTextLabel" parent="UI/TextBox/VBoxContainer"]
[node name="TextBoxLabel" type="RichTextLabel" parent="UI/TextBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
[node name="HBoxContainer" type="HBoxContainer" parent="UI/TextBox/VBoxContainer"]
layout_mode = 2
alignment = 1
[node name="Choice1" type="Button" parent="UI/TextBox/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "Choice 1"
[node name="Choice2" type="Button" parent="UI/TextBox/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "Choice 2"
text = "Test"
[node name="FeedbackCanvasModulate" type="CanvasModulate" parent="." groups=["effects"]]
unique_name_in_owner = true
@ -159,6 +137,21 @@ position = Vector2(578, -71)
scale = Vector2(1.001, 652)
texture = SubResource("GradientTexture1D_ij864")
[node name="Bob" type="Sprite2D" parent="Room"]
position = Vector2(242, 258)
texture = SubResource("GradientTexture2D_ty4ro")
[node name="Selectable" parent="Room/Bob" instance=ExtResource("3_g5hfc")]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Room/Bob/Selectable"]
polygon = PackedVector2Array(-50, 100, -50, -100, 50, -100, 50, 100)
[node name="Label" type="Label" parent="Room/Bob"]
offset_top = 2.0
offset_right = 40.0
offset_bottom = 25.0
text = "Bob"
[node name="RitualPlace" type="Sprite2D" parent="Room"]
position = Vector2(469, 390)
texture = SubResource("GradientTexture2D_ftstk")
@ -175,53 +168,53 @@ offset_right = 49.0
offset_bottom = 67.0
text = "Ritual place"
[node name="Shelves" type="Node2D" parent="Room"]
[node name="Shelves" type="Node2D" parent="."]
top_level = true
position = Vector2(1004, 324.5)
[node name="ShelvesBackground" type="Sprite2D" parent="Room/Shelves"]
[node name="ShelvesBackground" type="Sprite2D" parent="Shelves"]
scale = Vector2(300, 655)
texture = SubResource("GradientTexture1D_soglf")
[node name="UtilsDropoff" type="Node2D" parent="Room/Shelves"]
[node name="UtilsDropoff" type="Node2D" parent="Shelves"]
unique_name_in_owner = true
[node name="DropoffArea" parent="Room/Shelves/UtilsDropoff" instance=ExtResource("4_ycdy4")]
[node name="Area2D" type="Area2D" parent="Shelves/UtilsDropoff"]
collision_layer = 2
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Room/Shelves/UtilsDropoff/DropoffArea"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Shelves/UtilsDropoff/Area2D"]
shape = SubResource("RectangleShape2D_1u8w0")
[node name="Pliers" type="Sprite2D" parent="Room/Shelves" groups=["grabber"]]
[node name="Pliers" type="Sprite2D" parent="Shelves" groups=["grabber"]]
z_index = 10
position = Vector2(0, -206.5)
position = Vector2(38, -245.5)
scale = Vector2(0.5, 0.5)
texture = ExtResource("17_b1qrp")
offset = Vector2(76, -78)
script = ExtResource("18_come4")
[node name="PickupArea" parent="Room/Shelves/Pliers" instance=ExtResource("19_h8e4i")]
[node name="PickupArea" parent="Shelves/Pliers" instance=ExtResource("19_h8e4i")]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Room/Shelves/Pliers/PickupArea"]
position = Vector2(76, -60)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Shelves/Pliers/PickupArea"]
position = Vector2(2, 18)
rotation = 1.00484
shape = SubResource("CapsuleShape2D_1a0oe")
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Room/Shelves/Pliers/PickupArea"]
position = Vector2(46, -80)
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Shelves/Pliers/PickupArea"]
position = Vector2(-30, -2)
rotation = 0.363771
shape = SubResource("CapsuleShape2D_f4g1u")
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Room/Shelves/Pliers/PickupArea"]
shape = SubResource("CircleShape2D_efxa6")
[node name="GrabArea" type="Area2D" parent="Room/Shelves/Pliers"]
[node name="GrabArea" type="Area2D" parent="Shelves/Pliers"]
position = Vector2(-74, 78)
collision_layer = 8
collision_mask = 8
[node name="CollisionShape2D" type="CollisionShape2D" parent="Room/Shelves/Pliers/GrabArea"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Shelves/Pliers/GrabArea"]
shape = SubResource("CircleShape2D_8w656")
debug_color = Color(0.879882, 0.304191, 0.394852, 0.42)
[node name="Scalpel" type="Sprite2D" parent="Room/Shelves" groups=["cutter"]]
[node name="Scalpel" type="Sprite2D" parent="Shelves" groups=["cutter"]]
z_index = 10
position = Vector2(-72.9391, -140.263)
rotation = -2.00713
@ -230,37 +223,54 @@ texture = ExtResource("20_4lmeg")
offset = Vector2(-8.44019, 66.5461)
script = ExtResource("21_0cp0l")
[node name="PickupArea" parent="Room/Shelves/Scalpel" instance=ExtResource("19_h8e4i")]
[node name="PickupArea" parent="Shelves/Scalpel" instance=ExtResource("19_h8e4i")]
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Room/Shelves/Scalpel/PickupArea"]
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Shelves/Scalpel/PickupArea"]
position = Vector2(-7.59496, 64.7336)
shape = ExtResource("22_d2t1y")
[node name="CutArea" type="Area2D" parent="Room/Shelves/Scalpel"]
[node name="CutArea" type="Area2D" parent="Shelves/Scalpel"]
collision_layer = 5
collision_mask = 5
[node name="CollisionShape2D" type="CollisionShape2D" parent="Room/Shelves/Scalpel/CutArea"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Shelves/Scalpel/CutArea"]
position = Vector2(0.481193, 0.0901661)
shape = SubResource("CircleShape2D_qmwrh")
debug_color = Color(0.879882, 0.304191, 0.394852, 0.42)
[node name="CutHurtTimer" type="Timer" parent="Room/Shelves/Scalpel"]
[node name="CutHurtTimer" type="Timer" parent="Shelves/Scalpel"]
unique_name_in_owner = true
[node name="RitualBook" type="Node2D" parent="Room/Shelves"]
z_index = 10
position = Vector2(-92, 240.5)
[node name="BatDropoff" type="Node2D" parent="Shelves" groups=["bat_dropoff"]]
unique_name_in_owner = true
script = ExtResource("23_gngh3")
[node name="Sprite2D" type="Sprite2D" parent="Room/Shelves/RitualBook"]
[node name="Sprite2D" type="Sprite2D" parent="Shelves/BatDropoff"]
rotation = 1.5708
scale = Vector2(0.208791, 0.204598)
texture = ExtResource("5_lswn8")
[node name="Area2D" type="Area2D" parent="Shelves/BatDropoff"]
collision_layer = 8
collision_mask = 8
[node name="CollisionShape2D" type="CollisionShape2D" parent="Shelves/BatDropoff/Area2D"]
scale = Vector2(0.983051, 1)
shape = SubResource("RectangleShape2D_0odxb")
[node name="RitualBook" type="Node2D" parent="Shelves"]
position = Vector2(-92, 240.5)
script = ExtResource("12_ycdy4")
[node name="Sprite2D" type="Sprite2D" parent="Shelves/RitualBook"]
texture = SubResource("GradientTexture2D_2cqfq")
[node name="PickupArea" parent="Room/Shelves/RitualBook" instance=ExtResource("19_h8e4i")]
[node name="Selectable" parent="Shelves/RitualBook/Sprite2D" instance=ExtResource("3_g5hfc")]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Room/Shelves/RitualBook/PickupArea"]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Shelves/RitualBook/Sprite2D/Selectable"]
polygon = PackedVector2Array(-16, -64, -16, 64, 16, 64, 16, -64)
[node name="Label" type="Label" parent="Room/Shelves/RitualBook"]
[node name="Label" type="Label" parent="Shelves/RitualBook"]
offset_left = -17.0
offset_top = 40.5
offset_right = 68.0
@ -268,36 +278,11 @@ offset_bottom = 63.5
rotation = -1.5708
text = "Rituals 101"
[node name="Map" type="Node2D" parent="Room/Shelves"]
position = Vector2(43, 200.5)
[node name="PrototypeRitualBook" parent="." instance=ExtResource("13_ycdy4")]
[node name="Sprite2D2" type="Sprite2D" parent="Room/Shelves/Map"]
position = Vector2(2, 2.5)
skew = 0.115192
texture = SubResource("GradientTexture2D_w48qg")
[node name="Sprite2D" type="Sprite2D" parent="Room/Shelves/Map"]
skew = 0.115192
texture = SubResource("GradientTexture2D_dg77c")
[node name="Selectable" parent="Room/Shelves/Map/Sprite2D" instance=ExtResource("3_g5hfc")]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Room/Shelves/Map/Sprite2D/Selectable"]
polygon = PackedVector2Array(-16, -32, -16, 32, 16, 32, 16, -32)
[node name="Label" type="Label" parent="Room/Shelves/Map"]
offset_left = -13.0
offset_top = 17.5
offset_right = 27.0
offset_bottom = 39.8333
rotation = -1.49051
text = "Map"
[node name="Suitcase" parent="." instance=ExtResource("12_dg77c")]
position = Vector2(177, 487)
[connection signal="input_event" from="Room/Shelves/Pliers/GrabArea" to="Room/Shelves/Pliers" method="_on_grab_area_input_event"]
[connection signal="area_entered" from="Room/Shelves/Scalpel/CutArea" to="Room/Shelves/Scalpel" method="_on_cut_area_area_entered"]
[connection signal="area_exited" from="Room/Shelves/Scalpel/CutArea" to="Room/Shelves/Scalpel" method="_on_cut_area_area_exited"]
[connection signal="timeout" from="Room/Shelves/Scalpel/CutHurtTimer" to="Room/Shelves/Scalpel" method="_on_cut_hurt_timer_timeout"]
[connection signal="clicked" from="Room/Shelves/Map/Sprite2D/Selectable" to="." method="_on_map_selectable_clicked"]
[connection signal="clicked" from="Room/Bob/Selectable" to="." method="_on_bob_clicked"]
[connection signal="clicked" from="Room/RitualPlace/Selectable" to="." method="_on_ritual_place_clicked"]
[connection signal="area_entered" from="Shelves/Scalpel/CutArea" to="Shelves/Scalpel" method="_on_cut_area_area_entered"]
[connection signal="area_exited" from="Shelves/Scalpel/CutArea" to="Shelves/Scalpel" method="_on_cut_area_area_exited"]
[connection signal="timeout" from="Shelves/Scalpel/CutHurtTimer" to="Shelves/Scalpel" method="_on_cut_hurt_timer_timeout"]
[connection signal="clicked" from="Shelves/RitualBook/Sprite2D/Selectable" to="." method="_on_ritual_book_clicked"]

View file

@ -1,55 +0,0 @@
@tool
class_name MapPoint
extends Node2D
signal clicked
@export_tool_button("Update lines", "Callable") var update_lines = queue_redraw
@export var connected_map_points: Array[MapPoint] = []:
set(new_value):
for p in connected_map_points:
p.draw.disconnect(queue_redraw)
p.hidden.disconnect(queue_redraw)
connected_map_points = new_value
for p in connected_map_points:
p.draw.connect(queue_redraw)
p.hidden.connect(queue_redraw)
queue_redraw()
@export var is_shown_on_map: bool = false:
set(new_value):
is_shown_on_map = new_value
_set_point_shown_on_map.call_deferred()
@onready var hover_dot: Sprite2D = $HoverDot
func _ready():
queue_redraw()
func _on_area_2d_mouse_entered():
hover_dot.show()
func _on_area_2d_mouse_exited():
hover_dot.hide()
func _on_area_2d_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton and event.pressed:
clicked.emit()
get_viewport().set_input_as_handled()
func _draw():
if not is_shown_on_map: return
for p in connected_map_points:
if p.is_shown_on_map:
draw_dashed_line(Vector2.ZERO, to_local(p.global_position), Color.BLACK)
func _set_point_shown_on_map():
visible = is_shown_on_map
if not $Area2D: return
$Area2D.monitorable = is_shown_on_map
$Area2D.monitoring = is_shown_on_map
$Area2D.input_pickable = is_shown_on_map
queue_redraw()

View file

@ -1,53 +0,0 @@
class_name PrototypeMap
extends Node2D
signal dialog_triggered(dialog_map: DialogMap, map_points_to_show: Array[int], precondition: String)
signal shown_points_changed(new_shown_points: Array[int])
signal map_closed
const DIALOG_MAP = preload("res://dialog/dialog_map.tscn")
var shown_points: Array[int]:
set(new_value):
shown_points = new_value
shown_points_changed.emit(shown_points)
var next_points_to_unlock: Array[int] = []
func _ready():
for point in shown_points:
_get_map_point(point).is_shown_on_map = true
func _on_map_point_clicked():
if not $MapPoint2.is_shown_on_map:
_trigger_dialog(0, [1], "dark_cut_completed")
func _on_map_point_2_clicked():
if not $MapPoint3.is_shown_on_map:
_trigger_dialog(1, [2,3])
func _on_map_point_3_clicked():
_trigger_dialog(2)
func _on_map_point_4_clicked():
_trigger_dialog(3)
func _trigger_dialog(map_point_number: int, map_points_to_show: Array[int] = [], precondition: String = ""):
var dialog_map: DialogMap = DIALOG_MAP.instantiate()
dialog_map.map_point_number = map_point_number
dialog_triggered.emit(dialog_map, map_points_to_show, precondition)
func show_map_point(map_points_to_show: Array[int]):
if map_points_to_show.is_empty(): return
for point in map_points_to_show:
_get_map_point(point).is_shown_on_map = true
shown_points.append_array(map_points_to_show)
func _get_map_point(map_point_number: int) -> MapPoint:
return get_node("MapPoint%s"% (map_point_number+1)) as MapPoint
func _on_close_map_button_pressed():
map_closed.emit()

26
map_point.gd Normal file
View file

@ -0,0 +1,26 @@
@tool
class_name MapPoint
extends Node2D
@export_tool_button("Update lines", "Callable") var update_lines = queue_redraw
@export var connected_map_points: Array[MapPoint] = []:
set(new_value):
connected_map_points = new_value
queue_redraw()
@onready var hover_dot: Sprite2D = $HoverDot
func _ready():
queue_redraw()
func _on_area_2d_mouse_entered():
hover_dot.show()
func _on_area_2d_mouse_exited():
hover_dot.hide()
func _draw():
for p in connected_map_points:
draw_dashed_line(Vector2.ZERO, to_local(p.global_position), Color.BLACK)

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=7 format=3 uid="uid://b5tdh43sbe5nj"]
[ext_resource type="Script" uid="uid://bhct6bhjtnml0" path="res://map/map_point.gd" id="1_jfx02"]
[ext_resource type="Script" uid="uid://bhct6bhjtnml0" path="res://map_point.gd" id="1_jfx02"]
[sub_resource type="Gradient" id="Gradient_tn1m0"]
offsets = PackedFloat32Array(0.40636, 0.45583)
@ -40,11 +40,9 @@ texture = SubResource("GradientTexture2D_gpntq")
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 1024
collision_mask = 1024
collision_priority = 10.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("CircleShape2D_01fxh")
[connection signal="input_event" from="Area2D" to="." method="_on_area_2d_input_event"]
[connection signal="mouse_entered" from="Area2D" to="." method="_on_area_2d_mouse_entered"]
[connection signal="mouse_exited" from="Area2D" to="." method="_on_area_2d_mouse_exited"]

View file

@ -32,15 +32,5 @@ func grab_bat():
position = Vector2.ZERO
top_level = true
func abort_grabbing():
is_grabbed = false
grab_area.set_deferred("monitoring", true)
grab_area.set_deferred("monitorable", true)
path_follow.progress_ratio = 0.0
position = Vector2.ZERO
top_level = false
func drop_bat(new_parent: Node2D):
func drop_bat():
is_dropped = true
top_level = false
reparent.call_deferred(new_parent, false)

View file

@ -24,9 +24,13 @@ func _trigger_point_cut(point: CutSequencePoint):
var is_cut_valid = false
if cut_indices.is_empty():
is_cut_valid = cut_index == 0 or cut_index == cut_sequence_points.size() - 1
if not is_cut_valid:
print("Failed cut: Expected %s or %s as first point, but got %s." % [0, cut_sequence_points.size() - 1, cut_index])
else:
var direction = -1 if cut_indices[0] == 0 else 1
is_cut_valid = cut_index + direction == cut_indices[-1] # Expect the next index
if not is_cut_valid:
print("Failed cut: Expected %s as next point, but got %s." % [cut_indices[-1] - direction, cut_index])
if not is_cut_valid:
_fail_sequence()
@ -38,6 +42,7 @@ func _trigger_point_cut(point: CutSequencePoint):
_succeed_sequence()
func _fail_sequence():
print("Fail cut sequence")
for i in cut_indices:
cut_sequence_points[i].reset_cut()
cut_indices.clear()

View file

@ -10,7 +10,7 @@ signal step_failed
var feedback_canvas_modulate: FeedbackCanvasModulate
var bat_dropoff: Node2D
var bat_dropoff: BatDropoff
var patience_bar: ProgressBar
@ -20,7 +20,7 @@ var pliers: Pliers
func _ready():
grabbing_target = get_node(grabbing_target_path) as BatExtractionBat
pliers = get_tree().get_first_node_in_group("grabber") as Pliers
bat_dropoff = get_tree().get_first_node_in_group("bat_dropoff")
bat_dropoff = get_tree().get_first_node_in_group("bat_dropoff") as BatDropoff
feedback_canvas_modulate = get_tree().get_first_node_in_group("effects") as FeedbackCanvasModulate
patience_bar = get_tree().get_first_node_in_group("patience_bar") as ProgressBar
pliers.pliers_used.connect(_on_pliers_used)
@ -33,10 +33,6 @@ func _on_pliers_used(top_area: Area2D):
else:
_hurt()
func _exit_tree():
if grabbing_target.is_grabbed:
grabbing_target.abort_grabbing()
pliers.enable_dropoff()
func _target_grabbed():
pliers.disable_dropoff()
@ -44,7 +40,7 @@ func _target_grabbed():
func _target_dropped():
pliers.enable_dropoff()
grabbing_target.drop_bat(bat_dropoff)
grabbing_target.drop_bat()
step_succeeded.emit()
func _hurt():

View file

@ -22,9 +22,6 @@ func _ready():
elif child is GrabStep:
child.step_succeeded.connect(_on_grab_step_succeeded.bind(child))
_disable_node2d(child)
elif child is RitualStep:
child.step_succeeded.connect(_on_ritual_step_succeeded.bind(child))
_disable_node2d(child)
active_step = steps[0]
if active_step is GrabStep:
@ -48,11 +45,6 @@ func _on_cut_sequence_failed(cut_sequence: CutSequence):
pass
func _on_grab_step_succeeded(grab_step: GrabStep):
var next_index = steps.find(grab_step) + 1
active_step = steps[next_index]
_enable_node2d(active_step)
func _on_ritual_step_succeeded(ritual_step: RitualStep):
succeeded.emit()

View file

@ -5,6 +5,10 @@ signal picked_up()
signal dropped()
@onready var dropoff_area: Area2D = %UtilsDropoff.get_node("Area2D")
var is_clickable = false
var is_picked_up = false
var is_dropable = false
var is_dropping_enabled = true
@ -12,29 +16,30 @@ var parent: Node2D
func _ready():
mouse_entered.connect(func(): is_clickable = true)
mouse_exited.connect(func(): is_clickable = false)
parent = get_parent() as Node2D
func _on_input_event(viewport, event, shape_idx):
func _input(event):
if event is InputEventMouseButton and event.is_pressed():
if is_picked_up and is_dropable and is_dropping_enabled:
_drop()
elif not is_picked_up:
elif not is_picked_up and is_clickable:
_pickup()
func _physics_process(delta):
if is_picked_up:
parent.global_position = get_viewport().get_mouse_position()
if is_picked_up and event is InputEventMouseMotion:
parent.global_position = event.global_position
func _exit_tree():
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
func _on_dropoff_area_entered(area):
if area is not DropoffArea: return
is_dropable = true
if area == dropoff_area:
is_dropable = true
func _on_dropoff_area_exited(area):
if area is not DropoffArea: return
is_dropable = false
if area == dropoff_area:
is_dropable = false
func _pickup():
is_picked_up = true

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://c3of67m4ic212"]
[ext_resource type="Script" uid="uid://demo2viwvnjcx" path="res://pickup_area.gd" id="1_6qsiy"]
[ext_resource type="Script" uid="uid://demo2viwvnjcx" path="res://operation/pickup_area.gd" id="1_6qsiy"]
[node name="PickupArea" type="Area2D"]
collision_layer = 2
@ -9,4 +9,3 @@ script = ExtResource("1_6qsiy")
[connection signal="area_entered" from="." to="." method="_on_dropoff_area_entered"]
[connection signal="area_exited" from="." to="." method="_on_dropoff_area_exited"]
[connection signal="input_event" from="." to="." method="_on_input_event"]

View file

@ -12,7 +12,7 @@ func disable_dropoff():
func enable_dropoff():
pickup_area.is_dropping_enabled = true
func _unhandled_input(event):
func _input(event):
if event is InputEventMouseButton and pickup_area.is_picked_up and event.is_pressed():
var areas = grab_area.get_overlapping_areas()
if not areas.is_empty():

View file

@ -9,8 +9,6 @@ func _on_patience_bar_value_changed(value):
if value <= 0:
failed.emit()
func _on_operation_succeeded():
succeeded.emit()
func _on_abort_button_pressed():
failed.emit()

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=3 uid="uid://be0rqt7sk1da0"]
[gd_scene load_steps=18 format=3 uid="uid://be0rqt7sk1da0"]
[ext_resource type="Texture2D" uid="uid://bicjfwpoa3pma" path="res://operation/test_table.png" id="1_7i8d4"]
[ext_resource type="Script" uid="uid://bge4rddktehkh" path="res://operation/prototype_dark_cut.gd" id="1_vl0qk"]
@ -12,8 +12,6 @@
[ext_resource type="Script" uid="uid://bcmj8d22a0kg" path="res://operation/cut_sequence.gd" id="10_gcaa6"]
[ext_resource type="PackedScene" uid="uid://x5powiwrfash" path="res://operation/cut_sequence_point.tscn" id="11_hcsao"]
[ext_resource type="Script" uid="uid://cvts663aoxl7g" path="res://operation/bat_extraction_bat.gd" id="13_um5dt"]
[ext_resource type="Script" uid="uid://cgom2jfkjmwv8" path="res://operation/ritual_step.gd" id="14_uv6f2"]
[ext_resource type="PackedScene" uid="uid://qkwh186nbcya" path="res://ritual/prototype_ritual_book.tscn" id="15_37tl7"]
[ext_resource type="Script" uid="uid://diku6p1um3ko6" path="res://operation/grab_step.gd" id="18_d00rj"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_pgu75"]
@ -69,26 +67,18 @@ size_flags_vertical = 4
theme_override_styles/fill = SubResource("StyleBoxFlat_pgu75")
value = 100.0
[node name="AbortButton" type="Button" parent="DarkCutUI"]
layout_mode = 0
offset_left = 226.0
offset_top = 56.0
offset_right = 278.0
offset_bottom = 87.0
text = "Abort"
[node name="Background" type="Sprite2D" parent="."]
position = Vector2(576, 323.25)
scale = Vector2(1.001, 648)
texture = SubResource("GradientTexture1D_f6e8o")
[node name="TestTable" type="Sprite2D" parent="."]
position = Vector2(840, 356)
position = Vector2(613, 358)
texture = ExtResource("1_7i8d4")
[node name="TestBody1" type="Sprite2D" parent="."]
unique_name_in_owner = true
position = Vector2(847, 397)
position = Vector2(620, 399)
texture = ExtResource("2_atjyl")
[node name="Area2D" type="Area2D" parent="TestBody1"]
@ -99,7 +89,6 @@ collision_mask = 4
polygon = PackedVector2Array(0, -250, -39.2, -250, -45.6, -246, -48.9, -246, -54.9, -239, -56.2, -239, -61.1, -230, -62.6, -230, -67.5, -210, -69, -210, -69, -181.7, -65, -168, -65, -163.3, -49, -143, -47, -128.8, -47, -124.8, -63.3, -122, -67.3, -122, -102.9, -109.8, -113.5, -116, -124.4, -116, -148.3, -106, -150, -106, -150, 49.2, -146, 67.4, -146, 71.4, -138, 93.4, -138, 99.7, -132, 106.7, -132, 109, -115.2, 109, -108.2, 102, -106.5, 102, -101.5, 86, -100, 86, -99, 35, -99, 16.8, -96.5, 26, -96, 93, -100, 140.9, -100, 163.1, -95.7, 192, -94.9, 192, -91, 246.1, -91, 250, 61, 250, 61, 236.5, 58, 230.5, 58, 217.1, 68, 38.1, 68, 64.3, 74, 82.3, 74, 85, 82, 91, 82, 92.8, 93, 93.8, 93, 95, 109.8, 95, 117.7, 88, 119.8, 88, 128.8, 9, 129.9, 9, 131.9, -42, 133.1, -42, 132, -84, 132, -90.7, 121, -103.8, 121, -105.6, 113, -107.6, 113, -109.2, 90.1, -107.1, 87, -112.5, 87, -114.9, 75, -125, 75, -127.2, 44.8, -124, 31.2, -124, 33, -144.9, 33, -151.3, 48.9, -169, 50.4, -169, 54.4, -179, 56, -179, 56, -200.6, 43, -219.7, 43, -222, 30, -232, 30, -233.2, 0, -248.3)
[node name="Operation" type="Node2D" parent="."]
position = Vector2(227, -2)
script = ExtResource("7_mteqj")
[node name="CutSequence" type="Node2D" parent="Operation"]
@ -252,14 +241,5 @@ priority = 4
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Operation/BatGrabStep/BatExtractionBones/BonesHurtArea"]
polygon = PackedVector2Array(39, -86, 39, -84.3, 21, -75.2, -2, -75, -2, -74, -14.8, -74, -16, -76.5, -16, -79.8, -32.4, -74, -34.6, -74, -62.7, -84, -64.8, -84, -68, -80.8, -68, -78.2, -61, -71.2, -61, -69.3, -38, -65.3, -38, -63.6, -19, -67, -19, -59.5, -41, -53.5, -50.9, -54, -55.4, -54, -63.4, -59, -68.1, -59, -71.1, -54, -74.2, -54, -72, -49.6, -72, -45.8, -68, -43.8, -68, -42, -54, -42, -54, -40.9, -37.9, -42, -29.4, -42, -20, -48.7, -17.1, -44, -16, -24.9, -16, -16.2, 20, 21.8, 20, 23.2, 22.1, 24.3, 25.1, 22.3, 27.9, 27, 36.6, 27, 45, 21, 45, 16.9, 22.6, 2, 19.8, 2, 14.3, -3.5, 21, -6.8, 21, -13.1, 5.60001, -22.8, 15, -18.8, 15, -17, 23, -17, 23, -15.9, 40.1, -17, 45.5, -17, 48, -25.7, 48, -28.8, 37.1, -30, 25.3, -30, 4, -39.3, 4, -43.5, 21.8, -39, 42.4, -39, 46, -49.7, 46, -52.8, 42.8, -56, 40.2, -56, 37.2, -53, 22.1, -53, 3, -58.5, 3, -59.5, 5.7, -65.1, 30.1, -66, 36.8, -66, 49.8, -79, 51.3, -79, 52.4, -81.5, 50, -83.9, 50, -86)
[node name="RitualStep" type="Node2D" parent="Operation"]
position = Vector2(-366, -5)
script = ExtResource("14_uv6f2")
[node name="PrototypeRitualBook" parent="Operation/RitualStep" instance=ExtResource("15_37tl7")]
position = Vector2(179, 150)
[connection signal="value_changed" from="DarkCutUI/HBoxContainer/PatienceBar" to="." method="_on_patience_bar_value_changed"]
[connection signal="pressed" from="DarkCutUI/AbortButton" to="." method="_on_abort_button_pressed"]
[connection signal="succeeded" from="Operation" to="." method="_on_operation_succeeded"]
[connection signal="incantation_completed" from="Operation/RitualStep/PrototypeRitualBook" to="Operation/RitualStep" method="_on_ritual_book_incantation_completed"]

View file

@ -1,11 +0,0 @@
class_name RitualStep
extends Node2D
signal step_succeeded
@export var is_skipped: bool = false
func _on_ritual_book_incantation_completed():
step_succeeded.emit()

View file

@ -1 +0,0 @@
uid://cgom2jfkjmwv8

View file

@ -15,7 +15,7 @@ var _scalpel_degrees_default: float
@onready var feedback_canvas_modulate: FeedbackCanvasModulate = %FeedbackCanvasModulate
func _unhandled_input(event: InputEvent):
func _input(event: InputEvent):
if event is InputEventMouseButton:
if event.is_pressed() and is_cutting_possible:
start_cutting()

1
prototype_map.gd Normal file
View file

@ -0,0 +1 @@
extends Node2D

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://cb4cokd0lxacj"]
[ext_resource type="Script" uid="uid://cvcec0uf3erkv" path="res://map/prototype_map.gd" id="1_mj08v"]
[ext_resource type="PackedScene" uid="uid://b5tdh43sbe5nj" path="res://map/map_point.tscn" id="2_mj08v"]
[ext_resource type="Script" uid="uid://cvcec0uf3erkv" path="res://prototype_map.gd" id="1_mj08v"]
[ext_resource type="PackedScene" uid="uid://b5tdh43sbe5nj" path="res://map_point.tscn" id="2_mj08v"]
[sub_resource type="Gradient" id="Gradient_6vn6g"]
offsets = PackedFloat32Array(0.575972, 0.929329, 1)
@ -9,8 +9,8 @@ colors = PackedColorArray(0.74902, 0.647059, 0.541176, 1, 0.61, 0.527447, 0.4392
[sub_resource type="GradientTexture2D" id="GradientTexture2D_fjiih"]
gradient = SubResource("Gradient_6vn6g")
width = 700
height = 450
width = 850
height = 500
fill = 2
fill_from = Vector2(0.5, 0.5)
@ -18,36 +18,19 @@ fill_from = Vector2(0.5, 0.5)
script = ExtResource("1_mj08v")
[node name="Background" type="Sprite2D" parent="."]
position = Vector2(395, 292)
position = Vector2(497, 315)
texture = SubResource("GradientTexture2D_fjiih")
[node name="MapPoint1" parent="." node_paths=PackedStringArray("connected_map_points") instance=ExtResource("2_mj08v")]
[node name="MapPoint" parent="." node_paths=PackedStringArray("connected_map_points") instance=ExtResource("2_mj08v")]
position = Vector2(199, 332)
connected_map_points = [NodePath("../MapPoint2")]
is_shown_on_map = true
[node name="MapPoint2" parent="." node_paths=PackedStringArray("connected_map_points") instance=ExtResource("2_mj08v")]
visible = false
position = Vector2(256, 299)
connected_map_points = [NodePath("../MapPoint3"), NodePath("../MapPoint4")]
[node name="MapPoint3" parent="." instance=ExtResource("2_mj08v")]
visible = false
position = Vector2(315, 278)
[node name="MapPoint4" parent="." instance=ExtResource("2_mj08v")]
visible = false
position = Vector2(320, 330)
[node name="CloseMapButton" type="Button" parent="."]
offset_left = 619.0
offset_top = 87.0
offset_right = 707.0
offset_bottom = 118.0
text = "Close Map"
[connection signal="clicked" from="MapPoint1" to="." method="_on_map_point_clicked"]
[connection signal="clicked" from="MapPoint2" to="." method="_on_map_point_2_clicked"]
[connection signal="clicked" from="MapPoint3" to="." method="_on_map_point_3_clicked"]
[connection signal="clicked" from="MapPoint4" to="." method="_on_map_point_4_clicked"]
[connection signal="pressed" from="CloseMapButton" to="." method="_on_close_map_button_pressed"]

View file

@ -1,12 +1,6 @@
class_name PrototypeRitualBook
extends Node2D
signal incantation_completed
signal book_closed
func _on_incantation_completed():
incantation_completed.emit()
func _on_button_pressed():
book_closed.emit()

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=8 format=3 uid="uid://qkwh186nbcya"]
[ext_resource type="Script" uid="uid://dak6uc4v3us7w" path="res://ritual/incantation.gd" id="1_v6csu"]
[ext_resource type="Script" uid="uid://dsiaa53vt3y6e" path="res://ritual/prototype_ritual_book.gd" id="1_yc2mw"]
[ext_resource type="Script" uid="uid://cpscp5a5nxfop" path="res://ritual/incantation_text.gd" id="2_5ntyk"]
[ext_resource type="Script" uid="uid://dak6uc4v3us7w" path="res://incantation.gd" id="1_v6csu"]
[ext_resource type="Script" uid="uid://dsiaa53vt3y6e" path="res://prototype_ritual_book.gd" id="1_yc2mw"]
[ext_resource type="Script" uid="uid://cpscp5a5nxfop" path="res://incantation_text.gd" id="2_5ntyk"]
[sub_resource type="Gradient" id="Gradient_2cqfq"]
offsets = PackedFloat32Array(0.80212, 0.978799, 1)
@ -15,9 +15,9 @@ height = 400
[sub_resource type="Curve2D" id="Curve2D_5ntyk"]
_data = {
"points": PackedVector2Array(-21.0368, -45.0789, 21.0368, 45.0789, 28, 28, 0, 0, 0, 0, 84, 57, -30.0526, 3.00526, 30.0526, -3.00526, 127, 41, -37.5657, -19.5342, 37.5657, 19.5342, 213, 45, 11.2697, -20.2855, -11.2697, 20.2855, 240, 98, 42.8249, -12.7724, -42.8249, 12.7724, 172, 150, 27.7986, -26.296, -27.7986, 26.296, 40, 160, -15.7776, -22.5394, 15.7776, 22.5394, 42, 220, -27.0473, -14.275, 27.0473, 14.275, 113, 280, 0, 0, 0, 0, 230, 288)
"points": PackedVector2Array(0, 0, 0, 0, 202, 149, -40.482, 1.54217, 40.482, -1.54217, 248, 178, -17.3494, 5.01206, 17.3494, -5.01206, 309, 150, -10.7952, -15.0362, 10.7952, 15.0362, 380, 180, 0, 0, 0, 0, 380, 180, 32.7712, -32.7712, -32.7712, 32.7712, 379, 257, 30.385, 3.70613, -30.385, -3.70613, 305, 219, 0, 0, -49.7351, 23.1326, 255, 252, 27.3736, -12.3374, -27.3736, 12.3374, 198, 230, -28.5302, -24.6748, 28.5302, 24.6748, 202, 319, 0, 0, 0, 0, 377, 318)
}
point_count = 10
point_count = 11
[sub_resource type="CircleShape2D" id="CircleShape2D_v6csu"]
radius = 13.8924
@ -26,27 +26,21 @@ radius = 13.8924
script = ExtResource("1_yc2mw")
[node name="Left" type="Sprite2D" parent="."]
position = Vector2(151, 201)
position = Vector2(306, 311)
texture = SubResource("GradientTexture2D_yaehf")
[node name="Right" type="Sprite2D" parent="."]
position = Vector2(451, 201)
position = Vector2(606, 311)
rotation = 3.14159
texture = SubResource("GradientTexture2D_yaehf")
[node name="CloseButton" type="Button" parent="."]
offset_left = 543.0
offset_top = 7.0
offset_right = 593.0
offset_bottom = 38.0
text = "Close"
[node name="Incantation" type="Path2D" parent="."]
position = Vector2(-1, 1)
curve = SubResource("Curve2D_5ntyk")
script = ExtResource("1_v6csu")
[node name="Area2D" type="Area2D" parent="Incantation"]
position = Vector2(29, 28)
position = Vector2(202, 149)
rotation = 0.562498
collision_layer = 512
collision_mask = 512
@ -57,12 +51,9 @@ shape = SubResource("CircleShape2D_v6csu")
[node name="IncantationText" type="Control" parent="Incantation"]
layout_mode = 3
anchors_preset = 0
size_flags_horizontal = 3
size_flags_vertical = 3
offset_right = 40.0
offset_bottom = 23.0
script = ExtResource("2_5ntyk")
text = "Hallo dies ist ein langer TExt, er könnte auch eine Ritual sein. Wir werden xxx"
metadata/_edit_use_anchors_ = true
text = "Hallo dies ist ein langer TExt, er könnte auch eine Ritual sein. Wir werden sehen"
[connection signal="pressed" from="CloseButton" to="." method="_on_button_pressed"]
[connection signal="completed" from="Incantation" to="." method="_on_incantation_completed"]
[connection signal="visibility_changed" from="Incantation/IncantationText" to="Incantation/IncantationText" method="_on_visibility_changed"]

2
ritual_book.gd Normal file
View file

@ -0,0 +1,2 @@
class_name RitualBook
extends Node2D

1
ritual_book.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://ctpgjvo5g0sav

View file

@ -3,6 +3,7 @@ extends Area2D
signal clicked
var is_clickable = false
var selection_sprite: Sprite2D
func _ready():
@ -20,12 +21,14 @@ func _ready():
parent_sprite.call_deferred("add_child", selection_sprite)
parent_sprite.call_deferred("move_child", selection_sprite, 0)
func _input(event):
if is_clickable and event is InputEventMouseButton and event.is_pressed():
clicked.emit()
func _on_mouse_entered():
is_clickable = true
selection_sprite.show()
func _on_mouse_exited():
is_clickable = false
selection_sprite.hide()
func _on_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton and event.is_pressed():
clicked.emit()

View file

@ -7,6 +7,5 @@ collision_layer = 256
collision_mask = 256
script = ExtResource("1_ayyf7")
[connection signal="input_event" from="." to="." method="_on_input_event"]
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]

View file

@ -1,40 +0,0 @@
@tool
extends Node2D
@export var is_open = false:
set(new_value):
is_open = new_value
_update_suitcase()
@onready var dropoff_area: DropoffArea = $SuitcaseOpen/DropoffArea
func _ready():
if Engine.is_editor_hint(): return
_update_suitcase()
func _update_suitcase():
if not is_node_ready(): return
if is_open:
$SuitcaseOpen.show()
$SuitcaseClosed.hide()
else:
$SuitcaseOpen.hide()
$SuitcaseClosed.show()
$SuitcaseOpen/DropoffArea.input_pickable = is_open
$SuitcaseOpen/CloseOnClickArea.input_pickable = is_open
$SuitcaseClosed/OpenOnClickArea.input_pickable = not is_open
if Engine.is_editor_hint():
$SuitcaseOpen.queue_redraw()
$SuitcaseClosed.queue_redraw()
func _on_close_on_click_area_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton and event.is_pressed():
is_open = false
func _on_open_on_click_area_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton and event.is_pressed():
is_open = true

View file

@ -1 +0,0 @@
uid://nrefd2i0qqrf

View file

@ -1,41 +0,0 @@
[gd_scene load_steps=5 format=3 uid="uid://bgp8l04mw4ddh"]
[ext_resource type="Script" uid="uid://nrefd2i0qqrf" path="res://suitcase.gd" id="1_kguwf"]
[ext_resource type="Texture2D" uid="uid://cterukanhrwfv" path="res://suitcase_closed.png" id="1_q74i1"]
[ext_resource type="Texture2D" uid="uid://yrcdv8en42cl" path="res://suitcase_open.png" id="2_kguwf"]
[ext_resource type="PackedScene" uid="uid://cnq1uvadx0rwf" path="res://dropoff_area.tscn" id="4_kmisx"]
[node name="Suitcase" type="Node2D" groups=["bat_dropoff"]]
script = ExtResource("1_kguwf")
is_open = true
[node name="SuitcaseClosed" type="Sprite2D" parent="."]
visible = false
texture = ExtResource("1_q74i1")
[node name="OpenOnClickArea" type="Area2D" parent="SuitcaseClosed"]
collision_layer = 256
collision_mask = 256
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="SuitcaseClosed/OpenOnClickArea"]
polygon = PackedVector2Array(-10.4, -54.5, -77.5, -57.6, -77.5, -56.3, -82.8, -55.5, -127.7, -55.5, -129.7, -51.5, -131.1, -51.5, -152.1, 38.5, -153.3, 38.5, -158.3, 86.5, -159.5, 86.5, -159.5, 98.9, -152.5, 114.8, -152.5, 118.4, -134.5, 133.4, -134.5, 135.1, -124.7, 137.5, -121.2, 137.5, -116.5, 141.4, -116.5, 143, -103.5, 146.9, -103.5, 148.3, -63.6, 152.5, -51.5, 152.5, -46.5, 159.1, -46.5, 160.9, -21.6, 169.5, 28.2, 169.5, 50.5, 155.6, 50.5, 154.4, 73.6, 153.5, 93.7, 153.5, 110.6, 149.5, 115, 149.5, 124, 144.5, 126.1, 144.5, 157.1, 122.5, 158.6, 122.5, 167.6, 107.5, 169.1, 107.5, 172.2, 92.5, 173.5, 92.5, 173.5, 64.4, 165.5, 6.5, 165.5, 1.10001, 142.5, -52.9, 142.5, -55.5, 38.5, -54.5)
[node name="SuitcaseOpen" type="Sprite2D" parent="."]
texture = ExtResource("2_kguwf")
[node name="DropoffArea" parent="SuitcaseOpen" instance=ExtResource("4_kmisx")]
collision_layer = 10
collision_mask = 10
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="SuitcaseOpen/DropoffArea"]
polygon = PackedVector2Array(-93, -5, 20, -7, 107, -11, 116, 0, 118, 16, 139, 86, 138, 115, 125, 122, 99, 126, 92, 129, 51, 131, -68, 132, -78, 130, -102, 130, -121, 116, -121, 91, -105, 47)
[node name="CloseOnClickArea" type="Area2D" parent="SuitcaseOpen"]
collision_layer = 256
collision_mask = 256
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="SuitcaseOpen/CloseOnClickArea"]
polygon = PackedVector2Array(81.7, -169.5, -66.2, -169.5, -124.6, -165.5, -140.8, -165.5, -165.8, -157.5, -169.3, -157.5, -174.3, -152.5, -174.5, -95.5, -163.5, -80.9, -163.5, -78.6, -147.5, -63.6, -147.5, -61.5, -129.1, -48.5, -118.1, -31.3, 139.5, -32.9, 148.4, -43.5, 149.6, -43.5, 174.5, -85.4, 174.5, -162.6, 169.5, -164, 169.5, -165.4)
[connection signal="input_event" from="SuitcaseClosed/OpenOnClickArea" to="." method="_on_open_on_click_area_input_event"]
[connection signal="input_event" from="SuitcaseOpen/CloseOnClickArea" to="." method="_on_close_on_click_area_input_event"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cterukanhrwfv"
path="res://.godot/imported/suitcase_closed.png-a0150d65ae36bbc86b136d62c48b6fe0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://suitcase_closed.png"
dest_files=["res://.godot/imported/suitcase_closed.png-a0150d65ae36bbc86b136d62c48b6fe0.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View file

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://yrcdv8en42cl"
path="res://.godot/imported/suitcase_open.png-3e6547c8f880ff4c593a504fd95cf87d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://suitcase_open.png"
dest_files=["res://.godot/imported/suitcase_open.png-3e6547c8f880ff4c593a504fd95cf87d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -1,24 +0,0 @@
extends Node2D
var new_point
var end_point
var tween
func _on_area_2d_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton and event.pressed:
new_point = event.position
end_point = new_point
$Timer.start()
if tween: tween.kill()
tween = create_tween()
tween.tween_property(self, "end_point", new_point + (Vector2.RIGHT * 100), 3)
tween.tween_callback($Timer.stop)
func _draw():
if not new_point: return
draw_dashed_line(new_point, end_point, Color.BLACK, -1.0, 2.0, false, true)
func _on_timer_timeout():
print("Test")
queue_redraw()

View file

@ -1 +0,0 @@
uid://cnokg4x6m5u7m

View file

@ -1,21 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://cxrvqdp6l8lfo"]
[ext_resource type="Script" uid="uid://cnokg4x6m5u7m" path="res://test_dash_line_reveal.gd" id="1_k8vrm"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vgsv2"]
size = Vector2(1178, 630)
[node name="TestDashLineReveal" type="Node2D"]
script = ExtResource("1_k8vrm")
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(579, 305)
shape = SubResource("RectangleShape2D_vgsv2")
[node name="Timer" type="Timer" parent="."]
wait_time = 0.1
[connection signal="input_event" from="Area2D" to="." method="_on_area_2d_input_event"]
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]