diff --git a/.gitignore b/.gitignore index c672ad3..257440c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ # Godot 4+ specific ignores .godot/ +*.csproj.old # Binaries -bin/ \ No newline at end of file +bin/ +qol-builds/ diff --git a/1bit-game-jam.csproj b/1bit-game-jam.csproj index b63e5d0..c627206 100644 --- a/1bit-game-jam.csproj +++ b/1bit-game-jam.csproj @@ -1,4 +1,4 @@ - + net6.0 true diff --git a/1bit-game-jam.csproj.old.1 b/1bit-game-jam.csproj.old.1 new file mode 100644 index 0000000..d31daf9 --- /dev/null +++ b/1bit-game-jam.csproj.old.1 @@ -0,0 +1,7 @@ + + + net6.0 + true + bitgamejam + + \ No newline at end of file diff --git a/export_presets.cfg b/export_presets.cfg index 43bfce7..dcdae99 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -37,6 +37,7 @@ progressive_web_app/icon_512x512="" progressive_web_app/background_color=Color(0, 0, 0, 1) dotnet/include_scripts_content=false dotnet/include_debug_symbols=true +dotnet/embed_build_outputs=false [preset.1] @@ -82,6 +83,7 @@ application/product_name="" application/file_description="" application/copyright="" application/trademarks="" +application/export_angle=0 ssh_remote_deploy/enabled=false ssh_remote_deploy/host="user@host_ip" ssh_remote_deploy/port="22" @@ -101,6 +103,7 @@ Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorActi Remove-Item -Recurse -Force '{temp_dir}'" dotnet/include_scripts_content=false dotnet/include_debug_symbols=true +dotnet/embed_build_outputs=false [preset.2] @@ -112,7 +115,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="" +export_path="qol-builds/qol.x86_64" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false @@ -142,4 +145,5 @@ ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\") rm -rf \"{temp_dir}\"" dotnet/include_scripts_content=false -dotnet/include_debug_symbols=true +dotnet/include_debug_symbols=false +dotnet/embed_build_outputs=false diff --git a/locales/en.mo b/locales/en.mo new file mode 100644 index 0000000..6b29672 Binary files /dev/null and b/locales/en.mo differ diff --git a/locales/en.po b/locales/en.po new file mode 100644 index 0000000..c7e2ab2 --- /dev/null +++ b/locales/en.po @@ -0,0 +1,36 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: en\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.4.2\n" + +msgid "Press Start or Enter" +msgstr "Press Start or Enter" + +msgid "by Tea Sanctuary, 2023" +msgstr "by Tea Sanctuary, 2023" + +msgid "CONGRATULATIONS!" +msgstr "CONGRATULATIONS!" + +msgid "" +"It took you\n" +"{0} attempts\n" +"and {1}\n" +"to finish the game." +msgstr "" +"It took you\n" +"{0} attempts\n" +"and {1}\n" +"to finish the game." + +msgid "Thank you for playing! :)" +msgstr "Thank you for playing! :)" diff --git a/locales/ru.mo b/locales/ru.mo new file mode 100644 index 0000000..cb1f675 Binary files /dev/null and b/locales/ru.mo differ diff --git a/locales/ru.po b/locales/ru.po new file mode 100644 index 0000000..26b37e8 --- /dev/null +++ b/locales/ru.po @@ -0,0 +1,37 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" +"X-Generator: Poedit 3.4.2\n" + +msgid "Press Start or Enter" +msgstr "Нажмите Start или Enter" + +msgid "by Tea Sanctuary, 2023" +msgstr "разработчик: Tea Sanctuary, 2023" + +msgid "CONGRATULATIONS!" +msgstr "ПОЗДРАВЛЯЕМ!" + +msgid "" +"It took you\n" +"{0} attempts\n" +"and {1}\n" +"to finish the game." +msgstr "" +"Вам потребовалось\n" +"{0} попыток\n" +"и {1}\n" +"чтобы пройти игру." + +msgid "Thank you for playing! :)" +msgstr "Спасибо за игру! :)" diff --git a/locales/template.pot b/locales/template.pot new file mode 100644 index 0000000..1208104 --- /dev/null +++ b/locales/template.pot @@ -0,0 +1,17 @@ +msgid "" +msgstr "" + +msgid "Press Start or Enter" +msgstr "" + +msgid "by Tea Sanctuary, 2023" +msgstr "" + +msgid "CONGRATULATIONS!" +msgstr "" + +msgid "It took you\n{0} attempts\nand {1}\nto finish the game." +msgstr "" + +msgid "Thank you for playing! :)" +msgstr "" \ No newline at end of file diff --git a/prefabs/enemies/boss/claw.tscn b/prefabs/enemies/boss/claw.tscn index 2068990..c7782ea 100644 --- a/prefabs/enemies/boss/claw.tscn +++ b/prefabs/enemies/boss/claw.tscn @@ -27,5 +27,10 @@ shape = SubResource("CircleShape2D_v67co") position = Vector2(-2, 0) shape = SubResource("CircleShape2D_smr3g") +[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."] +avoidance_enabled = true +debug_use_custom = true +debug_path_custom_color = Color(0, 0, 1, 1) + [connection signal="body_entered" from="Area2D" to="." method="_OnEntered"] [connection signal="body_exited" from="Area2D" to="." method="_OnExited"] diff --git a/prefabs/enemies/living_armor.tscn b/prefabs/enemies/living_armor.tscn index 125417d..5d9cf09 100644 --- a/prefabs/enemies/living_armor.tscn +++ b/prefabs/enemies/living_armor.tscn @@ -4,7 +4,7 @@ [ext_resource type="Script" path="res://scripts/enemies/LivingArmor.cs" id="1_ofbsx"] [ext_resource type="PackedScene" uid="uid://cf0wpahgwygxx" path="res://prefabs/light_sense.tscn" id="2_xkyos"] -[sub_resource type="RectangleShape2D" id="RectangleShape2D_d1ojb"] +[sub_resource type="RectangleShape2D" id="RectangleShape2D_8sbby"] size = Vector2(15, 15) [sub_resource type="CircleShape2D" id="CircleShape2D_ex1co"] @@ -33,7 +33,7 @@ polygon = PackedVector2Array(-7, -4, -7, 15, 8, 15, 8, -4, 5, -11, -4, -11) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2(0.5, 7.5) -shape = SubResource("RectangleShape2D_d1ojb") +shape = SubResource("RectangleShape2D_8sbby") [node name="AreaOfSight" type="Area2D" parent="."] @@ -47,6 +47,11 @@ monitorable = false position = Vector2(1, 8) shape = SubResource("CircleShape2D_62y1x") +[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."] +path_desired_distance = 0.1 +target_desired_distance = 0.1 +avoidance_enabled = true + [connection signal="area_entered" from="LightSense" to="." method="_OnLightEntered"] [connection signal="area_exited" from="LightSense" to="." method="_OnLightExited"] [connection signal="body_entered" from="AreaOfSight" to="." method="_OnBodyEntered"] diff --git a/prefabs/enemies/wretched.tscn b/prefabs/enemies/wretched.tscn index 967a61b..6567d43 100644 --- a/prefabs/enemies/wretched.tscn +++ b/prefabs/enemies/wretched.tscn @@ -1,11 +1,11 @@ [gd_scene load_steps=6 format=3 uid="uid://bmyjqerhno5vi"] -[ext_resource type="SpriteFrames" uid="uid://blijqhtsnyq7n" path="res://sprites/enemies/wretched/wretched.tres" id="1_aqrsj"] +[ext_resource type="SpriteFrames" uid="uid://cisc0k30gpx1q" path="res://sprites/enemies/wretched/wretched.tres" id="1_aqrsj"] [ext_resource type="Script" path="res://scripts/enemies/Wretched.cs" id="1_ec388"] [ext_resource type="PackedScene" uid="uid://cf0wpahgwygxx" path="res://prefabs/light_sense.tscn" id="2_16fib"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_svj4b"] -size = Vector2(24, 16) +size = Vector2(15, 15) [sub_resource type="CircleShape2D" id="CircleShape2D_nortt"] radius = 15.0 @@ -28,7 +28,7 @@ frame_progress = 0.776966 polygon = PackedVector2Array(-5, -16, -7, -3, -7, 9, -11, 14, -11, 16, 8, 16, 8, 8, 7, 4, 7, -16) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] -position = Vector2(1, 8) +position = Vector2(0, 8) shape = SubResource("RectangleShape2D_svj4b") [node name="PlayerCollision" type="Area2D" parent="."] @@ -38,5 +38,13 @@ monitorable = false position = Vector2(1, 8) shape = SubResource("CircleShape2D_nortt") +[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."] +path_desired_distance = 0.1 +target_desired_distance = 0.1 +avoidance_enabled = true +avoidance_mask = 2 +debug_use_custom = true +debug_path_custom_color = Color(0, 1, 0, 1) + [connection signal="area_entered" from="LightSense" to="." method="_OnLightEntered"] [connection signal="body_entered" from="PlayerCollision" to="." method="_OnPlayerCollision"] diff --git a/prefabs/entities/pressure_plate.tscn b/prefabs/entities/pressure_plate.tscn index 91933c3..c10c162 100644 --- a/prefabs/entities/pressure_plate.tscn +++ b/prefabs/entities/pressure_plate.tscn @@ -1,10 +1,10 @@ [gd_scene load_steps=4 format=3 uid="uid://bj1ixwjdpnooo"] -[ext_resource type="SpriteFrames" uid="uid://chfnxa71xs3ww" path="res://sprites/tiles/floor/pressure_plate.tres" id="1_1wdq4"] +[ext_resource type="SpriteFrames" uid="uid://8qygv4lq4pjf" path="res://sprites/tiles/floor/pressure_plate.tres" id="1_1wdq4"] [ext_resource type="Script" path="res://scripts/entities/PressurePlate.cs" id="1_httlb"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_1jim7"] -size = Vector2(32, 32) +size = Vector2(24, 24) [node name="pressure_plate" type="Area2D"] z_index = -1 diff --git a/prefabs/entities/spikes.tscn b/prefabs/entities/spikes.tscn index 6fbfe54..92c188f 100644 --- a/prefabs/entities/spikes.tscn +++ b/prefabs/entities/spikes.tscn @@ -4,7 +4,7 @@ [ext_resource type="SpriteFrames" uid="uid://uith5rxps4s" path="res://sprites/tiles/floor/spikes/spikes.tres" id="2_t76h0"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_guqiy"] -size = Vector2(32, 32) +size = Vector2(24, 24) [node name="spikes" type="Area2D"] z_index = -1 @@ -12,8 +12,6 @@ script = ExtResource("1_r27mb") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] sprite_frames = ExtResource("2_t76h0") -frame = 2 -frame_progress = 1.0 [node name="Sprite2D" type="Sprite2D" parent="AnimatedSprite2D"] diff --git a/prefabs/virtual_cursor.tscn b/prefabs/virtual_cursor.tscn new file mode 100644 index 0000000..9881490 --- /dev/null +++ b/prefabs/virtual_cursor.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=3 format=3 uid="uid://4d6fhm87mn55"] + +[ext_resource type="Script" path="res://scripts/VirtualCursor.cs" id="1_va4ba"] +[ext_resource type="Texture2D" uid="uid://up1nl3dnhadr" path="res://sprites/cursor.png" id="2_k2bth"] + +[node name="VirtualCursor" type="Node2D"] +script = ExtResource("1_va4ba") + +[node name="CursorSprite" type="Sprite2D" parent="."] +texture = ExtResource("2_k2bth") diff --git a/project.godot b/project.godot index 8dd5ea9..1bc57cd 100644 --- a/project.godot +++ b/project.godot @@ -12,7 +12,7 @@ config_version=5 config/name="1bit-game-jam" run/main_scene="res://scenes/menu.tscn" -config/features=PackedStringArray("4.1", "C#", "Mobile") +config/features=PackedStringArray("4.2", "C#", "Mobile") boot_splash/bg_color=Color(0.141176, 0.141176, 0.141176, 1) config/icon="res://icon.svg" @@ -30,7 +30,7 @@ project/assembly_name="1bit-game-jam" character_up={ "deadzone": 0.5, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":87,"physical_keycode":87,"key_label":87,"unicode":0,"echo":false,"script":null) , null, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null) @@ -63,6 +63,7 @@ character_right={ flashlight_charge={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":false,"script":null) ] } ui_confirm={ @@ -71,6 +72,36 @@ ui_confirm={ , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":false,"script":null) ] } +ui_change_language={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":76,"key_label":0,"unicode":108,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null) +] +} +cursor_up={ +"deadzone": 0.5, +"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null) +] +} +cursor_down={ +"deadzone": 0.5, +"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null) +] +} +cursor_left={ +"deadzone": 0.5, +"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null) +] +} +cursor_right={ +"deadzone": 0.5, +"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null) +] +} + +[internationalization] + +locale/translations=PackedStringArray("res://locales/en.po", "res://locales/ru.po") [layer_names] diff --git a/scenes/level.tscn b/scenes/level.tscn index b9aada4..6d09561 100644 --- a/scenes/level.tscn +++ b/scenes/level.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=3 uid="uid://cn0rwyjern2vx"] +[gd_scene load_steps=28 format=3 uid="uid://cn0rwyjern2vx"] [ext_resource type="Script" path="res://scripts/Level.cs" id="1_cxv3e"] [ext_resource type="TileSet" uid="uid://c7x8hryljgpha" path="res://sprites/tiles/QoL.tres" id="1_kp7y7"] @@ -14,8 +14,8 @@ [ext_resource type="PackedScene" uid="uid://bo5we64scaa1x" path="res://prefabs/furniture/table2.tscn" id="11_43o4k"] [ext_resource type="PackedScene" uid="uid://cvfk53tse4okx" path="res://prefabs/furniture/book.tscn" id="12_7tfnm"] [ext_resource type="PackedScene" uid="uid://ccg3n7sobsvdw" path="res://prefabs/enemies/watcher.tscn" id="13_nbkmp"] -[ext_resource type="PackedScene" path="res://prefabs/enemies/living_armor.tscn" id="14_4tmmq"] -[ext_resource type="PackedScene" path="res://prefabs/enemies/wretched.tscn" id="15_3rigu"] +[ext_resource type="PackedScene" uid="uid://bpusphyhhg074" path="res://prefabs/enemies/living_armor.tscn" id="14_4tmmq"] +[ext_resource type="PackedScene" uid="uid://bmyjqerhno5vi" path="res://prefabs/enemies/wretched.tscn" id="15_3rigu"] [ext_resource type="PackedScene" uid="uid://crulyoxqqw74r" path="res://prefabs/entities/Teleport.tscn" id="16_c6ifr"] [ext_resource type="PackedScene" uid="uid://dteeck6gict0d" path="res://prefabs/entities/teleport_dest.tscn" id="17_0di6y"] [ext_resource type="PackedScene" uid="uid://cpi5lgdlnvhlg" path="res://prefabs/enemies/boss/boss.tscn" id="18_8j1w1"] @@ -24,6 +24,36 @@ [sub_resource type="RectangleShape2D" id="RectangleShape2D_kwmx6"] +[sub_resource type="NavigationPolygon" id="NavigationPolygon_ngvpl"] +vertices = PackedVector2Array(312, -944, 192, -944, 40, -984, 96, -984, 320, -816, 200, -816, 48, -888, 56, -888, 40, -760, 56, -760, 440, -584, -120, -584, -120, -720, 312, -888, 440, -1080, 280, -984, 280, -1032, -72, -760, -120, -1080, 224, -1032, 224, -984, 144, -984, 144, -1032, 96, -1032, 192, -888, 176, -888, 176, -944, 56, -944, -8, -984, 200, -760, 176, -760, 176, -816, 56, -816, -72, -888, 440, -376, 440, -168, 168, -168, 168, -296, -232, -376, -408, -296, -408, -856, -232, -720, -120, -856, -80, -816, 320, -760, -72, -944, 40, -816, 48, -944, -8, -1032, 40, -1032) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3), PackedInt32Array(4, 5, 6, 7), PackedInt32Array(8, 9, 10, 11, 12), PackedInt32Array(13, 0, 14, 10, 4), PackedInt32Array(14, 0, 15, 16), PackedInt32Array(17, 8, 12), PackedInt32Array(18, 14, 16, 19), PackedInt32Array(19, 20, 21, 22), PackedInt32Array(18, 19, 22), PackedInt32Array(18, 22, 23), PackedInt32Array(1, 24, 25, 26), PackedInt32Array(2, 1, 26), PackedInt32Array(2, 26, 27, 28), PackedInt32Array(5, 29, 30, 31), PackedInt32Array(6, 5, 31), PackedInt32Array(6, 31, 32, 33), PackedInt32Array(34, 35, 36, 37), PackedInt32Array(38, 34, 37, 39), PackedInt32Array(38, 39, 40, 41), PackedInt32Array(17, 12, 41, 40, 42, 43), PackedInt32Array(29, 44, 10), PackedInt32Array(20, 15, 0), PackedInt32Array(33, 43, 42, 18, 45), PackedInt32Array(30, 29, 10), PackedInt32Array(10, 44, 4), PackedInt32Array(24, 13, 4), PackedInt32Array(9, 30, 10), PackedInt32Array(32, 9, 8, 46), PackedInt32Array(33, 32, 46), PackedInt32Array(33, 46, 43), PackedInt32Array(25, 24, 4), PackedInt32Array(7, 25, 4), PackedInt32Array(27, 7, 6, 47), PackedInt32Array(28, 27, 47), PackedInt32Array(28, 47, 45), PackedInt32Array(28, 45, 18, 48), PackedInt32Array(21, 20, 0), PackedInt32Array(49, 48, 18), PackedInt32Array(49, 18, 23), PackedInt32Array(49, 23, 3, 2), PackedInt32Array(0, 3, 21)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(168, -168, 440, -168, 440, -376, -232, -376, -232, -720, -120, -720, -120, -584, 440, -584, 440, -1080, -120, -1080, -120, -856, -408, -856, -408, -296, 168, -296), PackedVector2Array(-72, -760, 40, -760, 40, -816, -80, -816), PackedVector2Array(56, -816, 56, -760, 176, -760, 176, -816), PackedVector2Array(200, -760, 320, -760, 320, -816, 200, -816), PackedVector2Array(-72, -888, 48, -888, 48, -944, -72, -944), PackedVector2Array(56, -944, 56, -888, 176, -888, 176, -944), PackedVector2Array(192, -888, 312, -888, 312, -944, 192, -944), PackedVector2Array(-8, -984, 40, -984, 40, -1032, -8, -1032), PackedVector2Array(96, -984, 144, -984, 144, -1032, 96, -1032), PackedVector2Array(224, -1032, 224, -984, 280, -984, 280, -1032)]) +source_geometry_group_name = &"navigation_polygon_source_group" + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_v2a1f"] +vertices = PackedVector2Array(897, -96, 897, 129, 607, 129, 607, -96) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(607, -96, 607, 129, 897, 129, 897, -96)]) +source_geometry_group_name = &"navigation_polygon_source_group" + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_2d3fn"] +vertices = PackedVector2Array(897, -512, 897, -287, 607, -287, 607, -512) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(607, -512, 607, -287, 897, -287, 897, -512)]) +source_geometry_group_name = &"navigation_polygon_source_group" + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_ackae"] +vertices = PackedVector2Array(447, 832, 865, 832, 865, 1153, 447, 1153) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(447, 1153, 865, 1153, 865, 832, 447, 832)]) +source_geometry_group_name = &"navigation_polygon_source_group" + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_wwnnq"] +vertices = PackedVector2Array(-48, -1870, 242, -1870, 242, -1645, -48, -1645) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(-48, -1645, 242, -1645, 242, -1870, -48, -1870)]) +source_geometry_group_name = &"navigation_polygon_source_group" + [node name="level" type="Node2D"] script = ExtResource("1_cxv3e") @@ -312,7 +342,7 @@ position = Vector2(630, -730) position = Vector2(322, -381) [node name="Wretched" parent="." instance=ExtResource("15_3rigu")] -position = Vector2(181, -383) +position = Vector2(216, -381) [node name="Wretched2" parent="." instance=ExtResource("15_3rigu")] position = Vector2(-241, -457) @@ -445,6 +475,22 @@ Facing = 2 [node name="And_puzzle_4" parent="." instance=ExtResource("20_1ng7x")] CountOfButtons = 4 +[node name="NavigationRegion2D" type="NavigationRegion2D" parent="."] +navigation_polygon = SubResource("NavigationPolygon_ngvpl") + +[node name="NavigationRegion2D2" type="NavigationRegion2D" parent="."] +navigation_polygon = SubResource("NavigationPolygon_v2a1f") + +[node name="NavigationRegion2D3" type="NavigationRegion2D" parent="."] +navigation_polygon = SubResource("NavigationPolygon_2d3fn") + +[node name="NavigationRegion2D4" type="NavigationRegion2D" parent="."] +navigation_polygon = SubResource("NavigationPolygon_ackae") + +[node name="NavigationRegion2D5" type="NavigationRegion2D" parent="."] +position = Vector2(655, 942) +navigation_polygon = SubResource("NavigationPolygon_wwnnq") + [connection signal="ButtonPressed" from="pressure_plate_puzzle_1" to="door_closed_puzzle_1" method="Open"] [connection signal="ButtonUnpressed" from="pressure_plate_puzzle_1" to="door_closed_puzzle_1" method="Close"] [connection signal="ButtonPressed" from="pressure_plate_puzzle_2" to="door_closed_puzzle_2" method="Open"] diff --git a/scenes/main_scene.tscn b/scenes/main_scene.tscn index f6d4957..1cb9bc6 100644 --- a/scenes/main_scene.tscn +++ b/scenes/main_scene.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=3 uid="uid://dhn7yt46fyac8"] +[gd_scene load_steps=24 format=3 uid="uid://dhn7yt46fyac8"] [ext_resource type="PackedScene" uid="uid://bhulqhxesd5gc" path="res://prefabs/player.tscn" id="1_65a7v"] [ext_resource type="AudioStream" uid="uid://bsy2d0bl3lgg0" path="res://sounds/crank.ogg" id="1_cweq4"] @@ -11,6 +11,7 @@ [ext_resource type="PackedScene" uid="uid://cn0rwyjern2vx" path="res://scenes/level.tscn" id="5_skctj"] [ext_resource type="Script" path="res://scripts/GameCamera.cs" id="6_quua3"] [ext_resource type="Script" path="res://scripts/PointLight2DWorkaround.cs" id="6_slohe"] +[ext_resource type="PackedScene" uid="uid://4d6fhm87mn55" path="res://prefabs/virtual_cursor.tscn" id="11_xqdcm"] [ext_resource type="Script" path="res://scripts/WinScreen.cs" id="13_prax6"] [ext_resource type="Theme" uid="uid://daxgxg7c8v0ih" path="res://themes/zx_theme.tres" id="14_g1c0r"] [ext_resource type="Script" path="res://scripts/DeathScreen.cs" id="15_12mhe"] @@ -22,7 +23,7 @@ point_count = 2 [sub_resource type="ShaderMaterial" id="ShaderMaterial_m680d"] shader = ExtResource("5_64d71") -[sub_resource type="ViewportTexture" id="ViewportTexture_57pph"] +[sub_resource type="ViewportTexture" id="ViewportTexture_meb87"] viewport_path = NodePath("FlashlightViewport") [sub_resource type="CircleShape2D" id="CircleShape2D_prnh4"] @@ -46,6 +47,9 @@ height = 192 [node name="Root" type="Node2D"] y_sort_enabled = true +[node name="VirtualCursor" parent="." instance=ExtResource("11_xqdcm")] +position = Vector2(169.203, 958.57) + [node name="GameManager" type="Node" parent="." node_paths=PackedStringArray("FirstZone", "Player")] script = ExtResource("1_ij566") FirstZone = NodePath("../Zones/PlayZone1") @@ -235,15 +239,16 @@ texture = ExtResource("3_8o315") [node name="Triangle" type="Polygon2D" parent="FlashlightViewport/CanvasGroup"] polygon = PackedVector2Array(-21, -25, 31, 29, -42, 31) -[node name="PlayerCamera" type="Camera2D" parent="." node_paths=PackedStringArray("Player")] +[node name="PlayerCamera" type="Camera2D" parent="." node_paths=PackedStringArray("Player", "Cursor")] script = ExtResource("6_quua3") Player = NodePath("../Player") CameraBounds = Vector2(30, 20) +Cursor = NodePath("../VirtualCursor") [node name="PointLight2D" type="PointLight2D" parent="PlayerCamera" node_paths=PackedStringArray("LightViewport")] blend_mode = 2 range_item_cull_mask = 2 -texture = SubResource("ViewportTexture_57pph") +texture = SubResource("ViewportTexture_meb87") script = ExtResource("6_slohe") LightViewport = NodePath("../../FlashlightViewport") diff --git a/scenes/menu.tscn b/scenes/menu.tscn index 298b9f5..523feac 100644 --- a/scenes/menu.tscn +++ b/scenes/menu.tscn @@ -281,6 +281,22 @@ text = "Press Start or Enter" horizontal_alignment = 1 vertical_alignment = 1 +[node name="Label2" type="Label" parent="CanvasLayer"] +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -18.0 +offset_bottom = 8.00002 +grow_horizontal = 2 +grow_vertical = 0 +rotation = -0.001216 +auto_translate = false +theme = ExtResource("3_d3ur4") +text = "Press L to change language" +horizontal_alignment = 1 +vertical_alignment = 1 + [node name="Flash" type="TextureRect" parent="CanvasLayer"] clip_children = 2 material = SubResource("ShaderMaterial_eqq24") diff --git a/scripts/DeathScreen.cs b/scripts/DeathScreen.cs index e8854f8..9f2071c 100644 --- a/scripts/DeathScreen.cs +++ b/scripts/DeathScreen.cs @@ -41,6 +41,7 @@ public partial class DeathScreen : TextureRect _playerSprite.Texture = animatedSprite2D.SpriteFrames.GetFrameTexture(animatedSprite2D.Animation, animatedSprite2D.Frame); _playerSprite.Position -= _playerSprite.Texture.GetSize() / 2; + _playerSprite.FlipH = animatedSprite2D.FlipH; } if (killer.FindChild("AnimatedSprite2D") is AnimatedSprite2D killerAnimatedSprite2D) @@ -49,6 +50,7 @@ public partial class DeathScreen : TextureRect _monsterSprite.Texture = killerAnimatedSprite2D.SpriteFrames.GetFrameTexture(killerAnimatedSprite2D.Animation, killerAnimatedSprite2D.Frame); _monsterSprite.Position -= _monsterSprite.Texture.GetSize() / 2; + _monsterSprite.FlipH = killerAnimatedSprite2D.FlipH; } Visible = true; diff --git a/scripts/Flashlight.cs b/scripts/Flashlight.cs index c506ab2..6dd8fa8 100644 --- a/scripts/Flashlight.cs +++ b/scripts/Flashlight.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using Godot; public partial class Flashlight : Node @@ -23,7 +24,7 @@ public partial class Flashlight : Node [Export] public Curve BrightnessCurve; [Export] public AudioStreamPlayer CrankSoundPlayer; - + private float FlashlightRadius = Constants.MaxFlashlightRadius; private float FlashlightEnergy = 0; private float FlashlightChargeTimeout = 1; diff --git a/scripts/GameCamera.cs b/scripts/GameCamera.cs index 52f7e7b..8be510d 100644 --- a/scripts/GameCamera.cs +++ b/scripts/GameCamera.cs @@ -1,3 +1,4 @@ +using System.Diagnostics; using Godot; public partial class GameCamera : Camera2D @@ -6,7 +7,10 @@ public partial class GameCamera : Camera2D [Export] public Vector2 CameraBounds = new(40, 30); [Export] public Vector2 CameraFollowBounds = new(20, 10); [Export] public float Speed = 0.5f; - + + [Export] public VirtualCursor Cursor; + [Export] public const float CursorSpeed = 2.0f; + /// /// World position of the flashlight /// @@ -14,6 +18,12 @@ public partial class GameCamera : Camera2D public override void _PhysicsProcess(double delta) { + Vector2 direction = Input.GetVector("cursor_left", "cursor_right", "cursor_up", "cursor_down"); + if (direction != Vector2.Zero) + { + FlashlightPosition += direction * CursorSpeed; + } + var difference = Vector2.Zero; var relativePlayerPosition = Player.Position - Position; @@ -39,6 +49,8 @@ public partial class GameCamera : Camera2D Position = (Position + difference).Round(); FlashlightPosition = (FlashlightPosition + difference).Round(); + Cursor.Position = FlashlightPosition; + } public override void _Input(InputEvent @event) @@ -48,6 +60,7 @@ public partial class GameCamera : Camera2D if (@event is InputEventMouseMotion eventMouseMotion) { FlashlightPosition = eventMouseMotion.Position - Constants.HalfScreenSize + Position; + //Cursor.Position = eventMouseMotion.Position - Constants.HalfScreenSize + Position; } } } diff --git a/scripts/GameManager.cs b/scripts/GameManager.cs index de5ab02..09e069c 100644 --- a/scripts/GameManager.cs +++ b/scripts/GameManager.cs @@ -39,6 +39,7 @@ public partial class GameManager : Node GD.Print("Restart stats"); IsPlaying = true; _gameInfo = new GameInfo(GetPathTo(FirstZone.PlayerSpawnPoint)); + _gameInfo.GameStart = Time.GetTicksMsec(); } StartGame(); @@ -46,7 +47,6 @@ public partial class GameManager : Node public void StartGame() { - _gameInfo.GameStart = Time.GetTicksMsec(); Player.GlobalPosition = GetNode(_gameInfo.Checkpoint).GlobalPosition; } diff --git a/scripts/Menu.cs b/scripts/Menu.cs index ca2fb38..9fc4132 100644 --- a/scripts/Menu.cs +++ b/scripts/Menu.cs @@ -1,13 +1,22 @@ +using System.Collections.Generic; using Godot; +using Godot.Collections; public partial class Menu : Node2D { private Timer _timer; private AudioStreamPlayer2D _thunderclap; private AnimationPlayer _animationPlayer; + private Array _translations = new Array{"en", "ru"}; + private int _languagesCount; + private int _currentLanguage = 0; + private Resource _cursorTexture; public override void _Ready() { + TranslationServer.SetLocale("en"); + _languagesCount = _translations.Count; + _timer = (Timer)FindChild("Timer"); _thunderclap = (AudioStreamPlayer2D)FindChild("Thunderclap"); _animationPlayer = (AnimationPlayer)FindChild("AnimationPlayer"); @@ -23,6 +32,14 @@ public partial class Menu : Node2D _animationPlayer.Play("thunder"); _thunderclap.Play(); _timer.Start(); + DisplayServer.MouseSetMode(DisplayServer.MouseMode.Hidden); + } + else if (@event.IsActionPressed("ui_change_language")) + { + _currentLanguage++; + if (_currentLanguage >= _languagesCount) + _currentLanguage = 0; + TranslationServer.SetLocale(_translations[_currentLanguage]); } } diff --git a/scripts/VirtualCursor.cs b/scripts/VirtualCursor.cs new file mode 100644 index 0000000..386faeb --- /dev/null +++ b/scripts/VirtualCursor.cs @@ -0,0 +1,30 @@ +using Godot; +using System; + +public partial class VirtualCursor : Node2D +{ + //[Export] public Node2D Cursor; + + protected Sprite2D CursorSprite; + // Called when the node enters the scene tree for the first time. + public override void _Ready() + { + CursorSprite = (Sprite2D)FindChild("CursorSprite"); + } + + // Called every frame. 'delta' is the elapsed time since the previous frame. + public override void _Process(double delta) + { + + } + + public override void _Input(InputEvent @event) + { + // base._Input(@event); + // + // if (@event is InputEventMouseMotion eventMouseMotion) + // { + // CursorSprite.Position = eventMouseMotion.Position - Constants.HalfScreenSize + Position; + // } + } +} diff --git a/scripts/WinScreen.cs b/scripts/WinScreen.cs index 76758c4..2e7723e 100644 --- a/scripts/WinScreen.cs +++ b/scripts/WinScreen.cs @@ -16,7 +16,9 @@ public partial class WinScreen : TextureRect Visible = true; TextLabel.Text = - $"It took you\n{Manager.GetAttempts()} attempts\nand {Manager.GetFormattedTimeElapsed()}\nto finish the game."; + string.Format(Tr("It took you\n{0} attempts\nand {1}\nto finish the game."), + Manager.GetAttempts(), + Manager.GetFormattedTimeElapsed()); } public override void _Input(InputEvent @event) diff --git a/scripts/enemies/Claw.cs b/scripts/enemies/Claw.cs index bcb1525..bd6ba5b 100644 --- a/scripts/enemies/Claw.cs +++ b/scripts/enemies/Claw.cs @@ -17,11 +17,14 @@ public partial class Claw : CharacterBody2D private float _stateTimeout = 0; private bool _isPlayerNearBy = false; private AnimatedSprite2D _sprite; + private NavigationAgent2D _nav; // Called when the node enters the scene tree for the first time. public override void _Ready() { _sprite = (AnimatedSprite2D)FindChild("AnimatedSprite2D"); + _nav = (NavigationAgent2D)FindChild("NavigationAgent2D"); + _nav.VelocityComputed += OnNavVelocityCompute; } // Called every frame. 'delta' is the elapsed time since the previous frame. @@ -38,10 +41,11 @@ public partial class Claw : CharacterBody2D break; case State.Moving: - var direction = (Player.Instance.Position - Position).Normalized(); - Velocity = direction * MovingSpeed; + _nav.TargetPosition = Player.Instance.Position; + var direction = (_nav.GetNextPathPosition() - Position).Normalized(); _sprite.FlipH = Velocity.X < 0.001f; _sprite.Play("default"); + _nav.Velocity = direction * MovingSpeed; MoveAndSlide(); break; case State.Prepare: @@ -87,4 +91,9 @@ public partial class Claw : CharacterBody2D GD.Print("Boss enabled"); _state = State.Moving; } + + private void OnNavVelocityCompute(Vector2 safeVelocity) + { + Velocity = safeVelocity; + } } diff --git a/scripts/enemies/LivingArmor.cs b/scripts/enemies/LivingArmor.cs index 0f43f3d..c773dc8 100644 --- a/scripts/enemies/LivingArmor.cs +++ b/scripts/enemies/LivingArmor.cs @@ -48,6 +48,7 @@ public partial class LivingArmor : CharacterBody2D private State _state; private float _timeSinceState; private AnimatedSprite2D _sprite; + private NavigationAgent2D _nav; private bool _isLitUp; //private readonly List _bodiesInSight = new List(); private readonly List _bodiesInSight = new List(); @@ -58,6 +59,8 @@ public partial class LivingArmor : CharacterBody2D public override void _Ready() { _sprite = (AnimatedSprite2D)FindChild("AnimatedSprite2D"); + _nav = (NavigationAgent2D)FindChild("NavigationAgent2D"); + _nav.VelocityComputed += OnNavVelocityCompute; _respawnPosition = Position; CurrentState = State.Waiting; var animationName = "side_walk"; @@ -78,6 +81,7 @@ public partial class LivingArmor : CharacterBody2D _sprite.Play(animationName); _sprite.Stop(); + } public override void _Process(double delta) @@ -127,13 +131,15 @@ public partial class LivingArmor : CharacterBody2D } break; } + if (_target is null) { _state = State.Waiting; return; } - var direction = (_target.Position - Position).Normalized(); - Velocity = direction * MovingSpeed; + + _nav.TargetPosition = _target.Position; + var direction = (_nav.GetNextPathPosition() - GlobalPosition).Normalized(); var animationName = "side_walk"; @@ -147,8 +153,8 @@ public partial class LivingArmor : CharacterBody2D _sprite.FlipH = Velocity.X < 0.001f && animationName == "side_walk"; _sprite.Play(animationName); + _nav.Velocity = direction * MovingSpeed; MoveAndSlide(); - //MoveAndCollide(direction); break; } @@ -252,5 +258,11 @@ public partial class LivingArmor : CharacterBody2D Position = _respawnPosition; // QueueFree(); // TODO } + + private void OnNavVelocityCompute(Vector2 safeVelocity) + { + Velocity = safeVelocity; + } + } diff --git a/scripts/enemies/Wretched.cs b/scripts/enemies/Wretched.cs index 9e959ee..da29cc0 100644 --- a/scripts/enemies/Wretched.cs +++ b/scripts/enemies/Wretched.cs @@ -50,11 +50,14 @@ public partial class Wretched : CharacterBody2D private State _state; private float _timeSinceState; private AnimatedSprite2D _sprite; + private NavigationAgent2D _nav; private bool _isActivated; public override void _Ready() { _sprite = (AnimatedSprite2D)FindChild("AnimatedSprite2D"); + _nav = (NavigationAgent2D)FindChild("NavigationAgent2D"); + _nav.VelocityComputed += OnNavVelocityCompute; CurrentState = State.Waiting; var animationName = "NonActivatedSide"; switch (Facing) @@ -93,8 +96,8 @@ public partial class Wretched : CharacterBody2D break; case State.Moving: - var direction = (Player.Instance.Position - Position).Normalized(); - Velocity = direction * MovingSpeed; + _nav.TargetPosition = Player.Instance.Position; + var direction = (_nav.GetNextPathPosition() - Position).Normalized(); var animationName = "ActivatedSide"; @@ -108,6 +111,7 @@ public partial class Wretched : CharacterBody2D _sprite.FlipH = Velocity.X < 0.001f && animationName == "ActivatedSide"; _sprite.Play(animationName); + _nav.Velocity = direction * MovingSpeed; MoveAndSlide(); break; } @@ -158,4 +162,9 @@ public partial class Wretched : CharacterBody2D EmitSignal(SignalName.Killed); QueueFree(); // TODO } + + private void OnNavVelocityCompute(Vector2 safeVelocity) + { + Velocity = safeVelocity; + } } diff --git a/scripts/entities/Spikes.cs b/scripts/entities/Spikes.cs index 8bb0e1b..08f9779 100644 --- a/scripts/entities/Spikes.cs +++ b/scripts/entities/Spikes.cs @@ -13,7 +13,7 @@ public partial class Spikes : Area2D } [Export] public bool Enabled = false; - [Export] public float SpikesTimeout = 1f; + [Export] public float SpikesTimeout = 2f; [Export] public float StartOffset = 0f; private AnimatedSprite2D _sprite; private State _state = State.Waiting; @@ -40,7 +40,7 @@ public partial class Spikes : Area2D switch (_state) { case State.Waiting: - _sprite.Stop(); + _sprite.Play("default"); _timeSinceState += (float)delta; if (_timeSinceState > SpikesTimeout) { @@ -49,11 +49,12 @@ public partial class Spikes : Area2D } break; case State.Opening: - _sprite.Play("default"); + _sprite.Play("activated"); KillBodiesOnButton(); break; case State.Closing: - _sprite.PlayBackwards("default"); + _sprite.PlayBackwards("activated"); + KillBodiesOnButton(); break; } } diff --git a/sprites/cursor.png b/sprites/cursor.png new file mode 100644 index 0000000..f7d1aca Binary files /dev/null and b/sprites/cursor.png differ diff --git a/sprites/cursor.png.import b/sprites/cursor.png.import new file mode 100644 index 0000000..3474851 --- /dev/null +++ b/sprites/cursor.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://up1nl3dnhadr" +path="res://.godot/imported/cursor.png-ab659432fe95e81e8963a978cc7193a5.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/cursor.png" +dest_files=["res://.godot/imported/cursor.png-ab659432fe95e81e8963a978cc7193a5.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 diff --git a/sprites/tiles/floor/spikes/spikes.tres b/sprites/tiles/floor/spikes/spikes.tres index c83293e..d417279 100644 --- a/sprites/tiles/floor/spikes/spikes.tres +++ b/sprites/tiles/floor/spikes/spikes.tres @@ -2,10 +2,6 @@ [ext_resource type="Texture2D" uid="uid://l3v1hs32uxfp" path="res://sprites/tiles/floor/spikes/spikes_0001-sheet.png" id="1_xhodh"] -[sub_resource type="AtlasTexture" id="AtlasTexture_ebjk6"] -atlas = ExtResource("1_xhodh") -region = Rect2(64, 0, 32, 32) - [sub_resource type="AtlasTexture" id="AtlasTexture_my1hb"] atlas = ExtResource("1_xhodh") region = Rect2(32, 0, 32, 32) @@ -14,19 +10,28 @@ region = Rect2(32, 0, 32, 32) atlas = ExtResource("1_xhodh") region = Rect2(0, 0, 32, 32) +[sub_resource type="AtlasTexture" id="AtlasTexture_qhlyu"] +atlas = ExtResource("1_xhodh") +region = Rect2(64, 0, 32, 32) + [resource] animations = [{ "frames": [{ "duration": 1.0, -"texture": SubResource("AtlasTexture_ebjk6") -}, { -"duration": 1.0, "texture": SubResource("AtlasTexture_my1hb") }, { "duration": 1.0, "texture": SubResource("AtlasTexture_nfdn1") }], "loop": false, +"name": &"activated", +"speed": 2.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_qhlyu") +}], +"loop": true, "name": &"default", -"speed": 3.0 +"speed": 5.0 }]