完成旋转锁的基本功能

This commit is contained in:
cakipaul 2025-01-06 21:23:26 +08:00
parent 5413e8fe33
commit 157171fdec
9 changed files with 338 additions and 77 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,25 +1,25 @@
[gd_resource type="SpriteFrames" load_steps=137 format=3 uid="uid://dercgk2rdfig"] [gd_resource type="SpriteFrames" load_steps=137 format=3 uid="uid://dercgk2rdfig"]
[ext_resource type="Texture2D" uid="uid://diewbtnc2oijl" path="res://asset/art/scene/c01/s01/bg_夜晚有墙.png" id="1_k3ot7"] [ext_resource type="Texture2D" uid="uid://diewbtnc2oijl" path="res://asset/art/scene/c01/s01_旧版序章/bg_夜晚有墙.png" id="1_k3ot7"]
[ext_resource type="Texture2D" uid="uid://c388dhpakqyf2" path="res://asset/art/scene/c01/s01/e_老奶奶喂老鼠.png" id="2_eg3uh"] [ext_resource type="Texture2D" uid="uid://c388dhpakqyf2" path="res://asset/art/scene/c01/s01_旧版序章/e_老奶奶喂老鼠.png" id="2_eg3uh"]
[ext_resource type="Texture2D" uid="uid://dl36n6gnne058" path="res://asset/art/scene/c01/s02/f_序章标题.png" id="3_s15vv"] [ext_resource type="Texture2D" uid="uid://dl36n6gnne058" path="res://asset/art/scene/c01/s02_旧版序章/f_序章标题.png" id="3_s15vv"]
[ext_resource type="Texture2D" uid="uid://dj4tqeen4wvm4" path="res://asset/art/scene/c01/s02/ux_老鼠吃肉_吃完.png" id="4_mo80j"] [ext_resource type="Texture2D" uid="uid://dj4tqeen4wvm4" path="res://asset/art/scene/c01/s02_旧版序章/ux_老鼠吃肉_吃完.png" id="4_mo80j"]
[ext_resource type="Texture2D" uid="uid://cnggic5fi8f5n" path="res://asset/art/scene/c01/s02/ux_老鼠吃肉_无光黑.png" id="5_npyjw"] [ext_resource type="Texture2D" uid="uid://cnggic5fi8f5n" path="res://asset/art/scene/c01/s02_旧版序章/ux_老鼠吃肉_无光黑.png" id="5_npyjw"]
[ext_resource type="Texture2D" uid="uid://cg8fara1bx5up" path="res://asset/art/scene/c01/s02/ux_老鼠吃肉_有光晕黑.png" id="6_mdnkw"] [ext_resource type="Texture2D" uid="uid://cg8fara1bx5up" path="res://asset/art/scene/c01/s02_旧版序章/ux_老鼠吃肉_有光晕黑.png" id="6_mdnkw"]
[ext_resource type="Texture2D" uid="uid://btrb2kcfv66f3" path="res://asset/art/scene/c01/s03/bg_夜晚门关着 有红色印记.png" id="7_6lbmm"] [ext_resource type="Texture2D" uid="uid://btrb2kcfv66f3" path="res://asset/art/scene/c01/s03_旧版序章/bg_夜晚门关着 有红色印记.png" id="7_6lbmm"]
[ext_resource type="Texture2D" uid="uid://dgdujmow4c8i3" path="res://asset/art/scene/c01/s03/e_柱子有红纹gaise.png" id="8_wqh8b"] [ext_resource type="Texture2D" uid="uid://dgdujmow4c8i3" path="res://asset/art/scene/c01/s03_旧版序章/e_柱子有红纹gaise.png" id="8_wqh8b"]
[ext_resource type="Texture2D" uid="uid://chm1n14j28vl1" path="res://asset/art/scene/c01/s03/ux_背景gaise.png" id="9_sf8ni"] [ext_resource type="Texture2D" uid="uid://chm1n14j28vl1" path="res://asset/art/scene/c01/s03_旧版序章/ux_背景gaise.png" id="9_sf8ni"]
[ext_resource type="Texture2D" uid="uid://d3cvo5feddtv2" path="res://asset/art/scene/c01/s03/ux_鬼差脸gaise.png" id="10_vf3m0"] [ext_resource type="Texture2D" uid="uid://d3cvo5feddtv2" path="res://asset/art/scene/c01/s03_旧版序章/ux_鬼差脸gaise.png" id="10_vf3m0"]
[ext_resource type="Texture2D" uid="uid://cjuvgjvtu0cr7" path="res://asset/art/scene/c01/s04/bg_底图带楼.png" id="11_1ntts"] [ext_resource type="Texture2D" uid="uid://cjuvgjvtu0cr7" path="res://asset/art/scene/c01/s04_旧版序章/bg_底图带楼.png" id="11_1ntts"]
[ext_resource type="Texture2D" uid="uid://b0gti8fx40hph" path="res://asset/art/scene/c01/s04/e_树.png" id="12_tccdj"] [ext_resource type="Texture2D" uid="uid://b0gti8fx40hph" path="res://asset/art/scene/c01/s04_旧版序章/e_树.png" id="12_tccdj"]
[ext_resource type="Texture2D" uid="uid://dtk3c3uqhn8ue" path="res://asset/art/scene/c01/s04/e_轿车.png" id="13_1plt5"] [ext_resource type="Texture2D" uid="uid://dtk3c3uqhn8ue" path="res://asset/art/scene/c01/s04_旧版序章/e_轿车.png" id="13_1plt5"]
[ext_resource type="Texture2D" uid="uid://d4cpbjlhnyu4t" path="res://asset/art/scene/c01/s04/f_动画字幕1.png" id="14_vao82"] [ext_resource type="Texture2D" uid="uid://d4cpbjlhnyu4t" path="res://asset/art/scene/c01/s04_旧版序章/f_动画字幕1.png" id="14_vao82"]
[ext_resource type="Texture2D" uid="uid://6o8p2236e84q" path="res://asset/art/scene/c01/s04/f_动画字幕1-05.png" id="15_bqgqw"] [ext_resource type="Texture2D" uid="uid://6o8p2236e84q" path="res://asset/art/scene/c01/s04_旧版序章/f_动画字幕1-05.png" id="15_bqgqw"]
[ext_resource type="Texture2D" uid="uid://wexv6fyvnlqr" path="res://asset/art/scene/c01/s04/f_动画字幕1-06.png" id="16_o1kwd"] [ext_resource type="Texture2D" uid="uid://wexv6fyvnlqr" path="res://asset/art/scene/c01/s04_旧版序章/f_动画字幕1-06.png" id="16_o1kwd"]
[ext_resource type="Texture2D" uid="uid://db3korc10nbmd" path="res://asset/art/scene/c01/s04/f_第一章标题.png" id="17_0dtov"] [ext_resource type="Texture2D" uid="uid://db3korc10nbmd" path="res://asset/art/scene/c01/s04_旧版序章/f_第一章标题.png" id="17_0dtov"]
[ext_resource type="Texture2D" uid="uid://d218l2nxoru2a" path="res://asset/art/scene/c01/s04/fg_前景1.png" id="18_n1rqy"] [ext_resource type="Texture2D" uid="uid://d218l2nxoru2a" path="res://asset/art/scene/c01/s04_旧版序章/fg_前景1.png" id="18_n1rqy"]
[ext_resource type="Texture2D" uid="uid://dho12x2b4l3yn" path="res://asset/art/scene/c01/s04/fg_前景2.png" id="19_1jd4o"] [ext_resource type="Texture2D" uid="uid://dho12x2b4l3yn" path="res://asset/art/scene/c01/s04_旧版序章/fg_前景2.png" id="19_1jd4o"]
[ext_resource type="Texture2D" uid="uid://b4n8nyvth1vv4" path="res://asset/art/scene/c01/s04/fg_前景3.png" id="20_bpq55"] [ext_resource type="Texture2D" uid="uid://b4n8nyvth1vv4" path="res://asset/art/scene/c01/s04_旧版序章/fg_前景3.png" id="20_bpq55"]
[ext_resource type="Texture2D" uid="uid://kc4726andgy2" path="res://asset/art/scene/c02/s01_街道/bg_公寓入口.png" id="21_yvd7t"] [ext_resource type="Texture2D" uid="uid://kc4726andgy2" path="res://asset/art/scene/c02/s01_街道/bg_公寓入口.png" id="21_yvd7t"]
[ext_resource type="Texture2D" uid="uid://dufigutxbvmld" path="res://asset/art/scene/c02/s01_街道/e_入口寻人启事.png" id="22_h14fi"] [ext_resource type="Texture2D" uid="uid://dufigutxbvmld" path="res://asset/art/scene/c02/s01_街道/e_入口寻人启事.png" id="22_h14fi"]
[ext_resource type="Texture2D" uid="uid://cc7gpv2ibnfqw" path="res://asset/art/scene/c02/s01_街道/ux_院长的信1.png" id="23_71xtk"] [ext_resource type="Texture2D" uid="uid://cc7gpv2ibnfqw" path="res://asset/art/scene/c02/s01_街道/ux_院长的信1.png" id="23_71xtk"]
@ -71,7 +71,7 @@
[ext_resource type="Texture2D" uid="uid://c3tp7dpc1fu3a" path="res://asset/art/scene/c02/s09_1014现实版/bg_1014房间-回忆版.png" id="69_gb46h"] [ext_resource type="Texture2D" uid="uid://c3tp7dpc1fu3a" path="res://asset/art/scene/c02/s09_1014现实版/bg_1014房间-回忆版.png" id="69_gb46h"]
[ext_resource type="Texture2D" uid="uid://bghqvw4ad1lni" path="res://asset/art/scene/c02/s10_裂缝通道/bg_裂缝通道.png" id="70_qyu8r"] [ext_resource type="Texture2D" uid="uid://bghqvw4ad1lni" path="res://asset/art/scene/c02/s10_裂缝通道/bg_裂缝通道.png" id="70_qyu8r"]
[ext_resource type="Texture2D" uid="uid://cb8l3x5gs0uh4" path="res://asset/art/scene/c02/s10_裂缝通道/fg_裂缝通道.png" id="71_rnr6p"] [ext_resource type="Texture2D" uid="uid://cb8l3x5gs0uh4" path="res://asset/art/scene/c02/s10_裂缝通道/fg_裂缝通道.png" id="71_rnr6p"]
[ext_resource type="Texture2D" uid="uid://dratgn85pd3de" path="res://asset/art/scene/c02/s11_3014回忆版/bg_3014里间+墙内空间.png" id="72_ihfqt"] [ext_resource type="Texture2D" uid="uid://dratgn85pd3de" path="res://asset/art/scene/c02/s11_3014回忆版/bg_3014里间墙内空间.png" id="72_ihfqt"]
[ext_resource type="Texture2D" uid="uid://di7ahmil8dhxi" path="res://asset/art/scene/c02/s11_3014回忆版/bg_裂缝通道.png" id="73_3konk"] [ext_resource type="Texture2D" uid="uid://di7ahmil8dhxi" path="res://asset/art/scene/c02/s11_3014回忆版/bg_裂缝通道.png" id="73_3konk"]
[ext_resource type="Texture2D" uid="uid://bca7055y0bq4s" path="res://asset/art/scene/c02/s11_3014回忆版/e_书桌组.png" id="74_1x1b1"] [ext_resource type="Texture2D" uid="uid://bca7055y0bq4s" path="res://asset/art/scene/c02/s11_3014回忆版/e_书桌组.png" id="74_1x1b1"]
[ext_resource type="Texture2D" uid="uid://de8310cj50ytn" path="res://asset/art/scene/c02/s11_3014回忆版/e_墙壁.png" id="75_m3of4"] [ext_resource type="Texture2D" uid="uid://de8310cj50ytn" path="res://asset/art/scene/c02/s11_3014回忆版/e_墙壁.png" id="75_m3of4"]

View File

@ -139,7 +139,7 @@ locale/translations_pot_files=PackedStringArray("res://asset/dialogue/item_descr
[layer_names] [layer_names]
2d_physics/layer_1="player" 2d_physics/layer_1="player"
2d_physics/layer_2="ground_boarder" 2d_physics/layer_2="wall"
2d_physics/layer_3="interactable" 2d_physics/layer_3="interactable"
2d_physics/layer_4="hud_mouse" 2d_physics/layer_4="hud_mouse"

View File

@ -17,6 +17,9 @@
[ext_resource type="FontFile" uid="uid://c4xo4de2eokky" path="res://asset/font/字体/三极行楷简体-粗.ttf" id="16_l2tph"] [ext_resource type="FontFile" uid="uid://c4xo4de2eokky" path="res://asset/font/字体/三极行楷简体-粗.ttf" id="16_l2tph"]
[ext_resource type="AudioStream" uid="uid://c8j3w5qhd21p7" path="res://asset/audio/sfx/game/八音盒/操纵八音盒.mp3" id="19_7mlnq"] [ext_resource type="AudioStream" uid="uid://c8j3w5qhd21p7" path="res://asset/audio/sfx/game/八音盒/操纵八音盒.mp3" id="19_7mlnq"]
[sub_resource type="Animation" id="Animation_j1llk"]
length = 0.001
[sub_resource type="Animation" id="Animation_j415e"] [sub_resource type="Animation" id="Animation_j415e"]
resource_name = "handle_animation" resource_name = "handle_animation"
length = 0.5 length = 0.5
@ -71,9 +74,6 @@ tracks/3/keys = {
"values": [Vector2(1, 1), Vector2(1, 1)] "values": [Vector2(1, 1), Vector2(1, 1)]
} }
[sub_resource type="Animation" id="Animation_j1llk"]
length = 0.001
[sub_resource type="AnimationLibrary" id="AnimationLibrary_8b6h5"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_8b6h5"]
_data = { _data = {
"RESET": SubResource("Animation_j1llk"), "RESET": SubResource("Animation_j1llk"),
@ -153,6 +153,7 @@ texture = ExtResource("1_j0wst")
[node name="MusicPlayer2D" type="AudioStreamPlayer2D" parent="."] [node name="MusicPlayer2D" type="AudioStreamPlayer2D" parent="."]
position = Vector2(407, 159) position = Vector2(407, 159)
stream = ExtResource("19_7mlnq") stream = ExtResource("19_7mlnq")
bus = &"game_sfx"
[node name="Box" type="TextureRect" parent="."] [node name="Box" type="TextureRect" parent="."]
layout_mode = 1 layout_mode = 1
@ -186,6 +187,7 @@ texture_normal = SubResource("AtlasTexture_aml8i")
flip_h = true flip_h = true
[node name="ButtonPositionPoints" type="Polygon2D" parent="."] [node name="ButtonPositionPoints" type="Polygon2D" parent="."]
visible = false
position = Vector2(282, 158) position = Vector2(282, 158)
polygon = PackedVector2Array(-75, 7, -55, 7, -34, 7, -14, 7, 7, 7, 28, 7, 50, 7, 71, 7, 92, 7, -72, -1, -53, -1, -33, -1, -14, -1, 7, -1, 27, -1, 48, -1, 70, -1, 90, -1, -71, -7, -52, -6, -33, -6, -13, -6, 7, -6, 27, -6, 47, -6, 69, -6, 89, -6, -70, -11, -51, -11, -32, -11, -13, -11, 7, -11, 27, -11, 47, -11, 68, -11, 88, -11, -69, -16, -50, -16, -31, -16, -13, -16, 7, -16, 27, -16, 46, -16, 68, -16, 87, -16, -68, -20, -49, -20, -31, -20, -13, -20, 7, -20, 27, -20, 46, -20, 67, -20, 86, -20, -66, -25, -48, -25, -31, -25, -13, -25, 7, -25, 26, -25, 46, -25, 66, -25, 85, -25) polygon = PackedVector2Array(-75, 7, -55, 7, -34, 7, -14, 7, 7, 7, 28, 7, 50, 7, 71, 7, 92, 7, -72, -1, -53, -1, -33, -1, -14, -1, 7, -1, 27, -1, 48, -1, 70, -1, 90, -1, -71, -7, -52, -6, -33, -6, -13, -6, 7, -6, 27, -6, 47, -6, 69, -6, 89, -6, -70, -11, -51, -11, -32, -11, -13, -11, 7, -11, 27, -11, 47, -11, 68, -11, 88, -11, -69, -16, -50, -16, -31, -16, -13, -16, 7, -16, 27, -16, 46, -16, 68, -16, 87, -16, -68, -20, -49, -20, -31, -20, -13, -20, 7, -20, 27, -20, 46, -20, 67, -20, 86, -20, -66, -25, -48, -25, -31, -25, -13, -25, 7, -25, 26, -25, 46, -25, 66, -25, 85, -25)

View File

@ -0,0 +1,70 @@
extends Control
@export var freeze := false
@export var gear_x_delta := [0, -18, -28, -40, -53, -70]
@export var actived_gear := 0:
set(val):
actived_gear = val
activate_gear()
@onready var key = $Key
var random_degrees := [0.0, 0.0, 0.0, 0.0, 0.0]
var key_origin_x := 0.0
var tween_key
func _ready() -> void:
key_origin_x = key.position.x
# randomize the initial rotation of the gears
for i in range(5):
random_degrees[i] = snappedi(randf_range(0, 360), 20)
var gear = get_node("Pivot/" + str(i)) as Area2D
gear.area_entered.connect(_on_gear_touched)
$"Pivot/5".area_entered.connect(_on_success)
_reset_all()
func _on_gear_touched(_area):
print("Gear touched!")
if not freeze:
_reset_all()
func _on_success(_area):
freeze = true
print("Success!")
#TODO
func _reset_all():
key.position.x = key_origin_x
for i in range(5):
var gear = get_node("Pivot/" + str(i))
gear.init_rotation(random_degrees[i])
actived_gear = 0
func _input(event: InputEvent) -> void:
if event.is_action("cancel"):
# TODO: go back to the previous scene
print("Cancel action triggered!")
elif event.is_action("left"):
if not freeze:
move_key()
elif event.is_action("right"):
if not freeze:
move_key(-1)
func activate_gear() -> void:
for i in range(5):
var gear = get_node("Pivot/" + str(i))
gear.active = i == actived_gear
func move_key(direction := 1):
if tween_key and tween_key.is_running():
return
actived_gear = clampi(actived_gear + direction, 0, 5)
tween_key = create_tween()
tween_key.tween_property(key, "position:x", key_origin_x + gear_x_delta[actived_gear], 0.5)

View File

@ -0,0 +1,140 @@
[gd_scene load_steps=13 format=3 uid="uid://ddpaot630cntr"]
[ext_resource type="Script" path="res://scene/little_game/旋转锁.gd" id="1_lag7y"]
[ext_resource type="Texture2D" uid="uid://cv3ijagml76v0" path="res://asset/art/little_game/旋转锁/旋转锁背景.png" id="1_srn7i"]
[ext_resource type="Script" path="res://scene/little_game/旋转锁_齿轮.gd" id="2_nfl7d"]
[ext_resource type="Texture2D" uid="uid://b5rn5erfwtoc3" path="res://asset/art/little_game/旋转锁/锁环1.png" id="2_y8tnv"]
[ext_resource type="Texture2D" uid="uid://dyh5py4021mrp" path="res://asset/art/little_game/旋转锁/锁环2.png" id="3_ge156"]
[ext_resource type="Texture2D" uid="uid://bx3rtav4opxlf" path="res://asset/art/little_game/旋转锁/锁环3.png" id="4_cmflu"]
[ext_resource type="Texture2D" uid="uid://dbm17sre7mw5o" path="res://asset/art/little_game/旋转锁/锁环4.png" id="5_7s7py"]
[ext_resource type="Texture2D" uid="uid://cuhk6yjfmtl73" path="res://asset/art/little_game/旋转锁/锁环5.png" id="6_qktt3"]
[ext_resource type="Texture2D" uid="uid://dv6en4c1pyb2k" path="res://asset/art/little_game/旋转锁/锁环6.png" id="6_rwu74"]
[ext_resource type="Texture2D" uid="uid://b2s0v602s7rfp" path="res://asset/art/little_game/旋转锁/钥匙.png" id="9_2tu7h"]
[ext_resource type="AudioStream" uid="uid://o6fwujx5pug3" path="res://asset/audio/sfx/game/旋转锁/转轮声.mp3" id="10_4iyuf"]
[ext_resource type="AudioStream" uid="uid://dmho8fjw45rbm" path="res://asset/audio/sfx/game/旋转锁/插销声.mp3" id="11_h2ycu"]
[node name="旋转锁" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_lag7y")
[node name="BG" type="TextureRect" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -282.0
offset_top = -120.0
offset_right = 282.0
offset_bottom = 120.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("1_srn7i")
[node name="Pivot" type="CenterContainer" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -20.0
offset_top = -20.0
offset_right = -20.0
offset_bottom = -20.0
grow_horizontal = 2
grow_vertical = 2
[node name="0" type="Area2D" parent="Pivot"]
collision_layer = 4
collision_mask = 4
script = ExtResource("2_nfl7d")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Pivot/0"]
polygon = PackedVector2Array(25, -51, 10, -55, -10, -55, -31, -46, -46, -32, -55, -5, -53, 15, -42, 36, -16, 54, 7, 56, 32, 48, 47, 32, 56, 13, 57, 6, 62, 6, 60, 23, 45, 45, 19, 60, -9, 62, -28, 57, -46, 41, -58, 21, -61, -5, -54, -30, -38, -49, -17, -59, 7, -61, 27, -56, 43, -46, 55, -32, 62, -13, 63, -5, 56, -5, 55, -16, 47, -30, 36, -42)
[node name="Sprite2D" type="Sprite2D" parent="Pivot/0"]
texture = ExtResource("2_y8tnv")
[node name="1" type="Area2D" parent="Pivot"]
collision_layer = 4
collision_mask = 4
script = ExtResource("2_nfl7d")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Pivot/1"]
polygon = PackedVector2Array(-6.5, -50, -11.5, -49.5, -11.5, -48.5, -15.5, -48.5, -15.5, -47.5, -18.5, -47.5, -18.5, -46.5, -20.5, -46.5, -20.5, -45.5, -22.5, -45.5, -22.5, -44.5, -24.5, -44.5, -24.5, -43.5, -26.5, -43.5, -26.5, -42.5, -28.5, -42.5, -28.5, -41.5, -29.3, -41.5, -30.3, -39.5, -32.5, -39.5, -32.5, -38.5, -33.5, -38.5, -33.5, -37.5, -34.5, -37.5, -34.5, -36.5, -35.5, -36.5, -35.5, -35.5, -36.5, -35.5, -36.5, -34.5, -37.3, -34.5, -38.3, -32.5, -39.5, -32.5, -39.5, -30.5, -40.3, -30.5, -41.3, -28.5, -42.5, -28.5, -42.5, -26.5, -43.5, -26.5, -43.5, -24.5, -44.5, -24.5, -44.5, -22.5, -45.4, -22.5, -46.4, -18.5, -47.5, -18.5, -47.5, -15.5, -48.5, -15.5, -48.5, -11.5, -49.5, -11.5, -49.5, -6.5, -50, 6.5, -49.5, 11.5, -48.5, 11.5, -48.5, 15.5, -47.5, 15.5, -47.5, 18.5, -46.5, 18.5, -46.5, 20.5, -45.5, 20.5, -45.5, 22.5, -44.5, 22.5, -44.5, 24.5, -43.5, 24.5, -43.5, 26.5, -42.5, 26.5, -42.5, 28.3, -40.5, 29.2, -40.5, 30.5, -39.5, 30.5, -39.5, 32.5, -38.5, 32.5, -38.5, 33.5, -37.5, 33.5, -37.5, 34.5, -36.5, 34.5, -36.5, 35.3, -34.5, 36.2, -34.5, 37.5, -33.5, 37.5, -33.5, 38.5, -32.5, 38.5, -32.5, 39.5, -30.5, 39.5, -30.5, 40.3, -28.5, 41.2, -28.5, 42.5, -26.5, 42.5, -26.5, 43.5, -24.5, 43.5, -24.5, 44.4, -20.5, 45.4, -20.5, 46.5, -18.5, 46.5, -18.5, 47.5, -15.5, 47.5, -15.5, 48.5, -11.5, 48.5, -11.5, 49.5, -6.5, 49.5, 6.5, 50, 11.5, 49.5, 11.5, 48.5, 15.5, 48.5, 15.5, 47.5, 18.5, 47.5, 18.5, 46.5, 20.5, 46.5, 20.5, 45.5, 22.5, 45.5, 22.5, 44.5, 24.5, 44.5, 24.5, 43.5, 26.5, 43.5, 26.5, 42.5, 28.5, 42.5, 28.5, 41.5, 29.3, 41.5, 30.3, 39.5, 32.5, 39.5, 32.5, 38.5, 33.5, 38.5, 33.5, 37.5, 34.5, 37.5, 34.5, 36.5, 35.5, 36.5, 35.5, 35.5, 36.5, 35.5, 36.5, 34.5, 37.3, 34.5, 38.3, 32.5, 39.5, 32.5, 39.5, 30.5, 40.3, 30.5, 41.3, 28.5, 42.5, 28.5, 42.5, 26.5, 43.5, 26.5, 43.5, 24.5, 44.5, 24.5, 44.5, 22.5, 45.4, 22.5, 46.4, 18.5, 47.5, 18.5, 47.5, 15.5, 48.5, 15.5, 48.5, 11.5, 49.5, 11.5, 49.5, 6.5, 50, 5, 44, 5, 43.5, 10.5, 42.5, 10.5, 42.5, 13.5, 41.5, 13.5, 41.5, 16.5, 40.5, 16.5, 40.5, 18.5, 39.5, 18.5, 39.5, 20.5, 38.5, 20.5, 38.5, 22.5, 37.5, 22.5, 37.5, 24.5, 36.5, 24.5, 36.5, 25.7, 34.5, 26.7, 34.5, 28.5, 33.5, 28.5, 33.5, 29.5, 32.5, 29.5, 32.5, 30.5, 31.5, 30.5, 31.5, 31.5, 30.5, 31.5, 30.5, 32.7, 28.5, 33.7, 28.5, 34.5, 26.5, 34.5, 26.5, 35.7, 24.5, 36.7, 24.5, 37.5, 22.5, 37.5, 22.5, 38.5, 20.5, 38.5, 20.5, 39.6, 16.5, 40.6, 16.5, 41.5, 13.5, 41.5, 13.5, 42.5, 10.5, 42.5, 10.5, 43.5, 4.5, 43.5, 4.5, 44.5, -4.5, 44.5, -4.5, 43.5, -10.5, 43.5, -10.5, 42.5, -13.5, 42.5, -13.5, 41.5, -16.5, 41.5, -16.5, 40.5, -18.5, 40.5, -18.5, 39.5, -20.5, 39.5, -20.5, 38.5, -22.5, 38.5, -22.5, 37.5, -24.5, 37.5, -24.5, 36.5, -25.7, 36.5, -26.7, 34.5, -28.5, 34.5, -28.5, 33.5, -29.5, 33.5, -29.5, 32.5, -30.5, 32.5, -30.5, 31.5, -31.5, 31.5, -31.5, 30.5, -32.7, 30.5, -33.7, 28.5, -34.5, 28.5, -34.5, 26.5, -35.7, 26.5, -36.7, 24.5, -37.5, 24.5, -37.5, 22.5, -38.5, 22.5, -38.5, 20.5, -39.6, 20.5, -40.6, 16.5, -41.5, 16.5, -41.5, 13.5, -42.5, 13.5, -42.5, 10.5, -43.5, 10.5, -43.5, 4.5, -44.5, 4.5, -44.5, -4.5, -43.5, -4.5, -43.5, -10.5, -42.5, -10.5, -42.5, -13.5, -41.5, -13.5, -41.5, -16.5, -40.5, -16.5, -40.5, -18.5, -39.5, -18.5, -39.5, -20.5, -38.5, -20.5, -38.5, -22.5, -37.5, -22.5, -37.5, -24.5, -36.5, -24.5, -36.5, -25.8, -34.5, -26.7, -34.5, -28.5, -33.5, -28.5, -33.5, -29.5, -32.5, -29.5, -32.5, -30.5, -31.5, -30.5, -31.5, -31.8, -29.5, -32.7, -29.5, -33.5, -28.5, -33.5, -28.5, -34.5, -26.5, -34.5, -26.5, -35.8, -24.5, -36.7, -24.5, -37.5, -22.5, -37.5, -22.5, -38.5, -20.5, -38.5, -20.5, -39.6, -16.5, -40.6, -16.5, -41.6, -10.5, -42.6, -10.5, -43.5, -4.5, -43.5, -4.5, -44.5, 4.5, -44.5, 4.5, -43.5, 10.5, -43.5, 10.5, -42.5, 13.5, -42.5, 13.5, -41.5, 16.5, -41.5, 16.5, -40.5, 18.5, -40.5, 18.5, -39.5, 20.5, -39.5, 20.5, -38.5, 22.5, -38.5, 22.5, -37.5, 24.5, -37.5, 24.5, -36.5, 25.7, -36.5, 26.7, -34.5, 28.5, -34.5, 28.5, -33.5, 29.5, -33.5, 29.5, -32.5, 30.5, -32.5, 30.5, -31.5, 31.5, -31.5, 31.5, -30.5, 32.7, -30.5, 33.7, -28.5, 34.5, -28.5, 34.5, -26.5, 35.7, -26.5, 36.7, -24.5, 37.5, -24.5, 37.5, -22.5, 38.5, -22.5, 38.5, -20.5, 39.6, -20.5, 40.6, -16.5, 41.5, -16.5, 41.5, -13.5, 42.5, -13.5, 42.5, -10.5, 43.5, -10.5, 43.5, -4.5, 44.5, -4.5, 45, -4, 50, -4, 50, -6.5, 49.5, -11.5, 48.5, -11.5, 48.5, -15.5, 47.5, -15.5, 47.5, -18.5, 46.5, -18.5, 46.5, -20.5, 45.5, -20.5, 45.5, -22.5, 44.5, -22.5, 44.5, -24.5, 43.5, -24.5, 43.5, -26.5, 42.5, -26.5, 42.5, -28.5, 41.5, -28.5, 41.5, -29.3, 39.5, -30.3, 39.5, -32.5, 38.5, -32.5, 38.5, -33.5, 37.5, -33.5, 37.5, -34.5, 36.5, -34.5, 36.5, -35.5, 35.5, -35.5, 35.5, -36.3, 33.5, -37.3, 33.5, -38.5, 32.5, -38.5, 32.5, -39.5, 30.5, -39.5, 30.5, -40.3, 28.5, -41.3, 28.5, -42.5, 26.5, -42.5, 26.5, -43.5, 24.5, -43.5, 24.5, -44.5, 22.5, -44.5, 22.5, -45.4, 18.5, -46.4, 18.5, -47.5, 15.5, -47.5, 15.5, -48.5, 11.5, -48.5, 11.5, -49.5, 6.5, -49.5)
[node name="Sprite2D" type="Sprite2D" parent="Pivot/1"]
texture = ExtResource("3_ge156")
[node name="2" type="Area2D" parent="Pivot"]
collision_layer = 4
collision_mask = 4
script = ExtResource("2_nfl7d")
active = true
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Pivot/2"]
polygon = PackedVector2Array(-5.5, -40, -10.5, -39.5, -10.5, -38.5, -13.5, -38.5, -13.5, -37.5, -16.5, -37.5, -16.5, -36.5, -18.5, -36.5, -18.5, -35.5, -20.5, -35.5, -20.5, -34.5, -22.5, -34.5, -22.5, -33.5, -23.3, -33.5, -24.3, -31.5, -26.5, -31.5, -26.5, -30.5, -27.5, -30.5, -27.5, -29.5, -28.5, -29.5, -28.5, -28.5, -29.3, -28.5, -30.3, -26.5, -31.5, -26.5, -31.5, -24.5, -32.3, -24.5, -33.3, -22.5, -34.5, -22.5, -34.5, -20.5, -35.4, -20.5, -36.4, -16.5, -37.4, -16.5, -38.4, -10.5, -39.5, -10.5, -39.5, -5.5, -40, 5.5, -39.5, 10.5, -38.5, 10.5, -38.5, 13.5, -37.5, 13.5, -37.5, 16.5, -36.5, 16.5, -36.5, 18.5, -35.5, 18.5, -35.5, 20.5, -34.5, 20.5, -34.5, 22.5, -33.5, 22.5, -33.5, 23.3, -31.5, 24.2, -31.5, 26.5, -30.5, 26.5, -30.5, 27.5, -29.5, 27.5, -29.5, 28.5, -28.5, 28.5, -28.5, 29.3, -26.5, 30.2, -26.5, 31.5, -24.5, 31.5, -24.5, 32.3, -22.5, 33.2, -22.5, 34.5, -20.5, 34.5, -20.5, 35.4, -16.5, 36.4, -16.5, 37.4, -10.5, 38.4, -10.5, 39.5, -5.5, 39.5, 5.5, 40, 10.5, 39.5, 10.5, 38.5, 13.5, 38.5, 13.5, 37.5, 16.5, 37.5, 16.5, 36.5, 18.5, 36.5, 18.5, 35.5, 20.5, 35.5, 20.5, 34.5, 22.5, 34.5, 22.5, 33.5, 23.3, 33.5, 24.3, 31.5, 26.5, 31.5, 26.5, 30.5, 27.5, 30.5, 27.5, 29.5, 28.5, 29.5, 28.5, 28.5, 29.3, 28.5, 30.3, 26.5, 31.5, 26.5, 31.5, 24.5, 32.3, 24.5, 33.3, 22.5, 34.5, 22.5, 34.5, 20.5, 35.4, 20.5, 36.4, 16.5, 37.4, 16.5, 38.4, 10.5, 39, 10, 39, 5, 34, 5, 33.5, 9.5, 32.5, 9.5, 32.5, 12.5, 31.5, 12.5, 31.5, 14.5, 30.5, 14.5, 30.5, 16.5, 29.5, 16.5, 29.5, 18.5, 28.5, 18.5, 28.5, 19.7, 26.5, 20.7, 26.5, 22.5, 25.5, 22.5, 25.5, 23.7, 23.5, 24.7, 23.5, 25.5, 22.5, 25.5, 22.5, 26.5, 20.5, 26.5, 20.5, 27.7, 18.5, 28.7, 18.5, 29.5, 16.5, 29.5, 16.5, 30.6, 12.5, 31.6, 12.5, 32.5, 9.5, 32.5, 9.5, 33.5, 4.5, 33.5, 4.5, 34.5, -4.5, 34.5, -4.5, 33.5, -9.5, 33.5, -9.5, 32.5, -12.5, 32.5, -12.5, 31.5, -14.5, 31.5, -14.5, 30.5, -16.5, 30.5, -16.5, 29.5, -18.5, 29.5, -18.5, 28.5, -19.7, 28.5, -20.7, 26.5, -22.5, 26.5, -22.5, 25.5, -23.5, 25.5, -23.5, 24.5, -24.7, 24.5, -25.7, 22.5, -26.5, 22.5, -26.5, 20.5, -27.7, 20.5, -28.7, 18.5, -29.5, 18.5, -29.5, 16.5, -30.6, 16.5, -31.6, 12.5, -32.5, 12.5, -32.5, 9.5, -33.5, 9.5, -33.5, 4.5, -34.5, 4.5, -34.5, -4.5, -33.5, -4.5, -33.5, -9.5, -32.5, -9.5, -32.5, -12.5, -31.5, -12.5, -31.5, -14.5, -30.5, -14.5, -30.5, -16.5, -29.5, -16.5, -29.5, -18.8, -27.5, -19.7, -27.5, -20.5, -26.5, -20.5, -26.5, -22.5, -25.5, -22.5, -25.5, -23.5, -24.5, -23.5, -24.5, -24.8, -22.5, -25.7, -22.5, -26.5, -20.5, -26.5, -20.5, -27.8, -18.5, -28.7, -18.5, -29.5, -16.5, -29.5, -16.5, -30.6, -12.5, -31.6, -12.5, -32.5, -9.5, -32.5, -9.5, -33.5, -4.5, -33.5, -4.5, -34.5, 4.5, -34.5, 4.5, -33.5, 9.5, -33.5, 9.5, -32.5, 12.5, -32.5, 12.5, -31.5, 14.5, -31.5, 14.5, -30.5, 16.5, -30.5, 16.5, -29.5, 18.5, -29.5, 18.5, -28.5, 19.7, -28.5, 20.7, -26.5, 22.5, -26.5, 22.5, -25.5, 23.5, -25.5, 23.5, -24.5, 24.7, -24.5, 25.7, -22.5, 26.5, -22.5, 26.5, -20.5, 27.7, -20.5, 28.7, -18.5, 29.5, -18.5, 29.5, -16.5, 30.6, -16.5, 31.6, -12.5, 32.5, -12.5, 32.5, -9.5, 33.5, -9.5, 33.5, -4.5, 34.5, -4.5, 34, -2, 40, -2, 40, -5.5, 39.5, -10.5, 38.5, -10.5, 38.5, -13.5, 37.5, -13.5, 37.5, -16.5, 36.5, -16.5, 36.5, -18.5, 35.5, -18.5, 35.5, -20.5, 34.5, -20.5, 34.5, -22.5, 33.5, -22.5, 33.5, -23.3, 31.5, -24.3, 31.5, -26.5, 30.5, -26.5, 30.5, -27.5, 29.5, -27.5, 29.5, -28.3, 27.5, -29.3, 27.5, -30.5, 26.5, -30.5, 26.5, -31.5, 24.5, -31.5, 24.5, -32.3, 22.5, -33.3, 22.5, -34.5, 20.5, -34.5, 20.5, -35.4, 16.5, -36.4, 16.5, -37.4, 10.5, -38.5, 10.5, -39.5, 5.5, -39.5)
[node name="Sprite2D" type="Sprite2D" parent="Pivot/2"]
texture = ExtResource("4_cmflu")
[node name="3" type="Area2D" parent="Pivot"]
collision_layer = 4
collision_mask = 4
script = ExtResource("2_nfl7d")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Pivot/3"]
polygon = PackedVector2Array(-4.5, -25, -8.5, -24.5, -8.5, -23.5, -11.5, -23.5, -11.5, -22.5, -13.3, -22.5, -14.3, -20.5, -16.5, -20.5, -16.5, -19.5, -17.5, -19.5, -17.5, -18.5, -18.3, -18.5, -19.3, -16.5, -20.5, -16.5, -20.5, -14.5, -21.5, -14.5, -21.5, -13.5, -22.5, -13.5, -22.5, -11.5, -23.5, -11.5, -23.5, -8.5, -24.5, -8.5, -24.5, -4.5, -25, 4.5, -24.5, 8.5, -23.5, 8.5, -23.5, 11.5, -22.5, 11.5, -22.5, 13.3, -20.5, 14.2, -20.5, 16.5, -19.5, 16.5, -19.5, 17.5, -18.5, 17.5, -18.5, 18.3, -16.5, 19.2, -16.5, 20.5, -14.5, 20.5, -14.5, 21.5, -13.5, 21.5, -13.5, 22.5, -11.5, 22.5, -11.5, 23.5, -8.5, 23.5, -8.5, 24.5, -4.5, 24.5, 4.5, 25, 8.5, 24.5, 8.5, 23.5, 11.5, 23.5, 11.5, 22.5, 13.3, 22.5, 14.3, 20.5, 16.5, 20.5, 16.5, 19.5, 17.5, 19.5, 17.5, 18.5, 18.3, 18.5, 19.3, 16.5, 20.5, 16.5, 20.5, 14.5, 21.5, 14.5, 21.5, 13.5, 22.5, 13.5, 22.5, 11.5, 23.5, 11.5, 23.5, 8.5, 24.5, 8.5, 24, 5, 19, 5, 18.5, 6.5, 17.5, 6.5, 17.5, 9.5, 16.5, 9.5, 16.5, 10.5, 15.5, 10.5, 15.5, 12.5, 14.5, 12.5, 14.5, 13.7, 12.5, 14.7, 12.5, 15.5, 10.5, 15.5, 10.5, 16.5, 9.5, 16.5, 9.5, 17.5, 3.5, 18.6, 3.5, 19.5, -3.5, 19.5, -3.5, 18.5, -6.5, 18.5, -6.5, 17.5, -9.7, 17.5, -10.7, 15.5, -12.5, 15.5, -12.5, 14.5, -13.7, 14.5, -14.7, 12.5, -15.5, 12.5, -15.5, 10.5, -16.5, 10.5, -16.5, 9.5, -17.5, 9.5, -17.5, 6.5, -18.5, 6.5, -18.5, 3.5, -19.5, 3.5, -19.5, -3.5, -18.5, -3.5, -18.5, -6.5, -17.5, -6.5, -17.5, -9.8, -15.5, -10.7, -15.5, -12.5, -14.5, -12.5, -14.5, -13.8, -12.5, -14.7, -12.5, -15.5, -10.5, -15.5, -10.5, -16.5, -9.5, -16.5, -9.5, -17.6, -3.5, -18.6, -3.5, -19.5, 3.5, -19.5, 3.5, -18.5, 6.5, -18.5, 6.5, -17.5, 9.5, -17.5, 9.5, -16.5, 10.5, -16.5, 10.5, -15.5, 12.5, -15.5, 12.5, -14.5, 13.7, -14.5, 14.7, -12.5, 15.5, -12.5, 15.5, -10.5, 16.5, -10.5, 16.5, -9.5, 17.5, -9.5, 17.5, -6.5, 18.5, -6.5, 18.5, -3.5, 19.5, -3.5, 20, -2, 25, -2, 25, -4.5, 24.5, -8.5, 23.5, -8.5, 23.5, -11.5, 22.5, -11.5, 22.5, -13.5, 21.5, -13.5, 21.5, -14.5, 20.5, -14.5, 20.5, -16.5, 19.5, -16.5, 19.5, -17.5, 18.5, -17.5, 18.5, -18.3, 16.5, -19.3, 16.5, -20.5, 14.5, -20.5, 14.5, -21.5, 13.5, -21.5, 13.5, -22.5, 11.5, -22.5, 11.5, -23.5, 8.5, -23.5, 8.5, -24.5, 4.5, -24.5)
[node name="Sprite2D" type="Sprite2D" parent="Pivot/3"]
texture = ExtResource("5_7s7py")
[node name="4" type="Area2D" parent="Pivot"]
collision_layer = 4
collision_mask = 4
script = ExtResource("2_nfl7d")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Pivot/4"]
polygon = PackedVector2Array(-4, -15, -4, -14, -6, -14, -6, -13, -8, -13, -8, -12, -10, -12, -10, -11, -11, -11, -11, -10, -12, -10, -12, -8, -13, -8, -13, -6, -14, -6, -14, -4, -15, -4, -15, 4, -14, 4, -14, 6, -13, 6, -13, 8, -12, 8, -12, 10, -11, 10, -11, 11, -10, 11, -10, 12, -8, 12, -8, 13, -6, 13, -6, 14, -4, 14, -4, 15, 4, 15, 4, 14, 6, 14, 6, 13, 8, 13, 8, 12, 10, 12, 10, 11, 11, 11, 11, 10, 12, 10, 12, 8, 13, 8, 13, 6, 14, 6, 14, 4, 9, 4, 9, 5, 8, 5, 8, 7, 7, 7, 7, 8, 5, 8, 5, 9, 3, 9, 3, 10, -3, 10, -3, 9, -5, 9, -5, 8, -7, 8, -7, 7, -8, 7, -8, 5, -9, 5, -9, 3, -10, 3, -10, -3, -9, -3, -9, -5, -8, -5, -8, -7, -7, -7, -7, -8, -5, -8, -5, -9, -3, -9, -3, -10, 3, -10, 3, -9, 5, -9, 5, -8, 7, -8, 7, -7, 8, -7, 8, -5, 9, -5, 9, -3, 10, -3, 10, -2, 15, -2, 15, -4, 14, -4, 14, -6, 13, -6, 13, -8, 12, -8, 12, -10, 11, -10, 11, -11, 10, -11, 10, -12, 8, -12, 8, -13, 6, -13, 6, -14, 4, -14, 4, -15)
[node name="Sprite2D" type="Sprite2D" parent="Pivot/4"]
texture = ExtResource("6_qktt3")
[node name="5" type="Area2D" parent="Pivot"]
collision_layer = 4
collision_mask = 4
script = ExtResource("2_nfl7d")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Pivot/5"]
polygon = PackedVector2Array(-5, -5, -5, 5, 5, 5, 5, -5)
[node name="Sprite2D" type="Sprite2D" parent="Pivot/5"]
texture = ExtResource("6_rwu74")
[node name="Key" type="Area2D" parent="."]
position = Vector2(385, 139)
collision_layer = 4
collision_mask = 4
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Key"]
polygon = PackedVector2Array(49.5, -4.5, 9, -4, -18, -1, -52, -1, -52, 1, -18, 1, 9, 4, 49.5, 4.5, 49.5, 3, 52, 3, 52, -3, 49.5, -3)
[node name="Sprite2D" type="Sprite2D" parent="Key"]
texture = ExtResource("9_2tu7h")
[node name="SfxGear" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("10_4iyuf")
bus = &"game_sfx"
[node name="SfxKey" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("11_h2ycu")
bus = &"game_sfx"

View File

@ -0,0 +1,49 @@
extends Area2D
@export var active := false
@export var rotation_step_degrees := 20.0
@export var target_rotation_degrees := 0.0
@onready var sfx_gear = $"../../SfxGear" as AudioStreamPlayer
func _input(event: InputEvent) -> void:
if not active:
return
if event.is_action("up"):
# rotate the lock counterclockwise
rotate_lock(-1)
elif event.is_action("down"):
# rotate the lock clockwise
rotate_lock(1)
var last_direction = 0
var current_angular_velocity = 0.0
func init_rotation(deg: float) -> void:
rotation = deg_to_rad(deg)
target_rotation_degrees = deg
func _physics_process(delta: float) -> void:
var diff = target_rotation_degrees - rotation_degrees
if abs(diff) > 0.1:
var direction = sign(diff)
var target_angular_velocity = direction * 60.0
current_angular_velocity = lerp(current_angular_velocity, target_angular_velocity, 0.2)
rotation_degrees += current_angular_velocity * delta
if active and not sfx_gear.playing:
sfx_gear.play()
elif active and sfx_gear.playing:
sfx_gear.stop()
func rotate_lock(direction: int) -> void:
var new_target = snappedf(
rotation_degrees + direction * rotation_step_degrees, rotation_step_degrees
)
if abs(new_target - target_rotation_degrees) > rotation_step_degrees * 1.2:
return
target_rotation_degrees = new_target