diff --git a/asset/art/ui/journal.png b/asset/art/ui/journal.png deleted file mode 100644 index a3020fc5..00000000 Binary files a/asset/art/ui/journal.png and /dev/null differ diff --git a/asset/art/ui/journal.png.import b/asset/art/ui/journal.png.import deleted file mode 100644 index c57dcaeb..00000000 --- a/asset/art/ui/journal.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://hmevnsvjteff" -path="res://.godot/imported/journal.png-51760d87548ed92041538049b35691fc.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://asset/art/ui/journal.png" -dest_files=["res://.godot/imported/journal.png-51760d87548ed92041538049b35691fc.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/asset/audio/peiyin/convert.sh b/asset/audio/peiyin/convert.sh index 1f9c6c00..06042b6f 100644 --- a/asset/audio/peiyin/convert.sh +++ b/asset/audio/peiyin/convert.sh @@ -18,5 +18,5 @@ for file in *.mp3 do # put the output files to the ./ogg directory # the quality range is from 0–10, where 10 is the highest quality and 3–7 are a good range to try - ffmpeg -i "$file" -c:a libvorbis -qscale:a 8 "./ogg/${file%.mp3}.ogg" + ffmpeg -i "$file" -c:a libvorbis -qscale:a 8 "./ogg/${file}.ogg" done \ No newline at end of file diff --git a/asset/audio/sfx/game/弹珠游戏/drop.ogg b/asset/audio/sfx/game/弹珠游戏/drop.ogg new file mode 100644 index 00000000..cf2a5f56 Binary files /dev/null and b/asset/audio/sfx/game/弹珠游戏/drop.ogg differ diff --git a/asset/audio/sfx/game/弹珠游戏/drop.ogg.import b/asset/audio/sfx/game/弹珠游戏/drop.ogg.import new file mode 100644 index 00000000..62d0791c --- /dev/null +++ b/asset/audio/sfx/game/弹珠游戏/drop.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://dcef4son60cs7" +path="res://.godot/imported/drop.ogg-a53ac368036d2a4e14fed89eedc4da75.oggvorbisstr" + +[deps] + +source_file="res://asset/audio/sfx/game/弹珠游戏/drop.ogg" +dest_files=["res://.godot/imported/drop.ogg-a53ac368036d2a4e14fed89eedc4da75.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0.0 +bpm=240.0 +beat_count=1 +bar_beats=4 diff --git a/asset/audio/sfx/game/弹珠游戏/hit.ogg b/asset/audio/sfx/game/弹珠游戏/hit.ogg new file mode 100644 index 00000000..91689b27 Binary files /dev/null and b/asset/audio/sfx/game/弹珠游戏/hit.ogg differ diff --git a/asset/audio/sfx/game/弹珠游戏/hit.ogg.import b/asset/audio/sfx/game/弹珠游戏/hit.ogg.import new file mode 100644 index 00000000..46b1235f --- /dev/null +++ b/asset/audio/sfx/game/弹珠游戏/hit.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://bb6njoaxi2hbx" +path="res://.godot/imported/hit.ogg-9da9ad6db1f1bdde25a185bcf7848519.oggvorbisstr" + +[deps] + +source_file="res://asset/audio/sfx/game/弹珠游戏/hit.ogg" +dest_files=["res://.godot/imported/hit.ogg-9da9ad6db1f1bdde25a185bcf7848519.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0.0 +bpm=240.0 +beat_count=2 +bar_beats=4 diff --git a/asset/audio/sfx/game/弹珠游戏/loop.ogg b/asset/audio/sfx/game/弹珠游戏/loop.ogg new file mode 100644 index 00000000..1da5afae Binary files /dev/null and b/asset/audio/sfx/game/弹珠游戏/loop.ogg differ diff --git a/asset/audio/sfx/game/弹珠游戏/loop.ogg.import b/asset/audio/sfx/game/弹珠游戏/loop.ogg.import new file mode 100644 index 00000000..fd478322 --- /dev/null +++ b/asset/audio/sfx/game/弹珠游戏/loop.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://beijvb65selr5" +path="res://.godot/imported/loop.ogg-bb35577ce09c3023646981ff71c929f0.oggvorbisstr" + +[deps] + +source_file="res://asset/audio/sfx/game/弹珠游戏/loop.ogg" +dest_files=["res://.godot/imported/loop.ogg-bb35577ce09c3023646981ff71c929f0.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0.0 +bpm=240.0 +beat_count=4 +bar_beats=2 diff --git a/asset/audio/sfx/game/弹珠游戏/弹珠hit.wav.import b/asset/audio/sfx/game/弹珠游戏/弹珠hit.wav.import new file mode 100644 index 00000000..0e17d424 --- /dev/null +++ b/asset/audio/sfx/game/弹珠游戏/弹珠hit.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://hf7u7h0kd6pj" +path="res://.godot/imported/弹珠hit.wav-8bb434a37098cfc43c2816575d7a35be.sample" + +[deps] + +source_file="res://asset/audio/sfx/game/弹珠游戏/弹珠hit.wav" +dest_files=["res://.godot/imported/弹珠hit.wav-8bb434a37098cfc43c2816575d7a35be.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/asset/audio/sfx/game/弹珠游戏/弹珠shoot.wav.import b/asset/audio/sfx/game/弹珠游戏/弹珠shoot.wav.import new file mode 100644 index 00000000..1c4ff304 --- /dev/null +++ b/asset/audio/sfx/game/弹珠游戏/弹珠shoot.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bev7buxwg2dkp" +path="res://.godot/imported/弹珠shoot.wav-dde3259dc8973a96e33bb8cd4d7c0756.sample" + +[deps] + +source_file="res://asset/audio/sfx/game/弹珠游戏/弹珠shoot.wav" +dest_files=["res://.godot/imported/弹珠shoot.wav-dde3259dc8973a96e33bb8cd4d7c0756.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/asset/dialogue/c02.csv b/asset/dialogue/c02.csv index c0dcd01b..ec4bf1a6 100644 --- a/asset/dialogue/c02.csv +++ b/asset/dialogue/c02.csv @@ -16,6 +16,7 @@ c02_李氏王赖子_耗子精10,“好了,其他的回去讲”,,王癞子,,[# (这不可能!),(这不可能!),,,, (游戏开始咯),(游戏开始咯),,,, [wave amp=20.0 freq=5.0][shake rate=10.0 level=3] 把弹珠拿出来 [/wave][/shake],[wave amp=20.0 freq=5.0][shake rate=10.0 level=3] 把弹珠拿出来 [/wave][/shake],,,, +碰到边界你就输了!,碰到边界你就输了!,,,, c02_吕萍_天暗,“天色变暗了”,,吕萍,, c02_吕萍_井旁01,“这么冷的天,怎么这树的叶子还这么茂盛”,,吕萍,,[#wait=3] c02_吕萍_井旁音效,...,,,,[#wait=2] @@ -136,7 +137,7 @@ c02_s03_敲门游戏,“(示例)理发上楼,看病上楼”,,???,, 我没输...你骗人!,我没输...你骗人!,,,, 这不可能!不不不...,这不可能!不不不...,,,, 我还有很多弹珠,玩到我赢为止!,我还有很多弹珠,玩到我赢为止!,,,, -碰到边界你就输了!,碰到边界你就输了!,,,, +先碰到边界你就输了!,先碰到边界你就输了!,,,, (井边疯子对话),(井边疯子对话),,,, (歌谣),(歌谣),,,, (霸凌对话.),(霸凌对话.),,,, diff --git a/asset/dialogue/c02.dialogue b/asset/dialogue/c02.dialogue index f1865b5a..de3a2ed4 100644 --- a/asset/dialogue/c02.dialogue +++ b/asset/dialogue/c02.dialogue @@ -333,7 +333,7 @@ # 游戏失败 ~ c02_弹珠游戏fail -碰到边界你就输了! +先碰到边界你就输了! => END! ~ c02_s11_井边疯子对话 diff --git a/project.godot b/project.godot index dbf50273..a76758f5 100644 --- a/project.godot +++ b/project.godot @@ -134,11 +134,6 @@ run={ "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":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } -jump={ -"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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) -] -} interact={ "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":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null) @@ -161,11 +156,6 @@ prop_right={ , Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(427, 48),"global_position":Vector2(446, 139),"factor":0.0300018,"button_index":5,"canceled":false,"pressed":true,"double_click":false,"script":null) ] } -toggle_journal={ -"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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) -] -} escape={ "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":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) diff --git a/scene/journal/journal.gd b/scene/journal/journal.gd deleted file mode 100644 index 01ef2361..00000000 --- a/scene/journal/journal.gd +++ /dev/null @@ -1,142 +0,0 @@ -@tool -extends Control - -@export var locked := false: - set(val): - locked = val - if is_node_ready() and locked: - display = false -@export var display := false: - set(val): - if is_node_ready() and display != val: - _toggle_display() - display = val -@export var boundart_rect := Rect2(0, 0, 1000, 1000): - set(val): - boundart_rect = val - queue_redraw() -@export_group("Tip", "tip_") -@export var tip_content := "": - set(val): - tip_content = val - if is_node_ready(): - reload() -@export var tip_font_size := 12 -@export var tip_font_color := Color(1, 1, 1) -@export var tip_item_position := Vector2(220, 220) - -@onready var tip_container = $Tips as GridContainer -@onready var items_root = $ItemsRoot as Node2D - -var sty_box_empty := StyleBoxEmpty.new() - -var item_scene := preload("res://scene/journal/journal_item.tscn") -var tip_script := preload("res://scene/journal/journal_tip.gd") -var item_script := preload("res://scene/journal/journal_item.gd") -var items_dict := {} - - -func _ready() -> void: - reload() - if GlobalConfig.DEBUG: - locked = false - display = true - else: - locked = true - display = false - _toggle_display(false) - - -func reload(): - for c in tip_container.get_children(): - c.queue_free() - for v in items_dict.values(): - v.queue_free() - items_dict.clear() - var btn_name_prefix = "tip_btn_" - for i in range(tip_content.length()): - var tip = tip_content[i] as String - var btn_margin = MarginContainer.new() - btn_margin.set("theme_override_constants/margin_left", -5) - btn_margin.set("theme_override_constants/margin_right", -5) - btn_margin.set("theme_override_constants/margin_top", -4) - btn_margin.set("theme_override_constants/margin_bottom", -4) - var tip_btn = Button.new() - tip_btn.flat = true - tip_btn.text = tip - tip_btn.toggle_mode = true - tip_btn.set("theme_override_styles/focus", sty_box_empty) - tip_btn.set("theme_override_font_sizes/font_size", tip_font_size) - tip_btn.custom_minimum_size = Vector2(tip_font_size, tip_font_size) - tip_btn.add_theme_color_override("font_color", tip_font_color) - tip_btn.size_flags_horizontal = Control.SIZE_SHRINK_CENTER - tip_btn.size_flags_vertical = Control.SIZE_SHRINK_CENTER - tip_btn.set_script(tip_script) - tip_btn.toggled.connect(_on_toggle_btn.bind(tip, tip_btn)) - tip_btn.name = btn_name_prefix + str(i) - btn_margin.add_child(tip_btn) - tip_container.add_child(btn_margin) - # items_dict[tip] = tip_btn - - -func _on_toggle_btn(toggled_on: bool, content: String, btn) -> void: - if not toggled_on and items_dict.has(btn.name): - items_dict[btn.name].queue_free() - items_dict.erase(content) - elif toggled_on: - var item = item_scene.instantiate() - item.label_text = content - item.boundart_rect = boundart_rect - item.position = tip_item_position + Vector2(randf_range(-10, 10), randf_range(-10, 10)) - items_root.add_child(item) - items_dict[btn.name] = item - - -func _draw() -> void: - if Engine.is_editor_hint(): - # draw boundart_rect frame - draw_rect(boundart_rect, Color(1, 0, 0), false, 2) - - -var display_tween: Tween - - -func _toggle_display(use_tween := true): - if display_tween and display_tween.is_running(): - display_tween.kill() - if display: - if use_tween: - display_tween = create_tween() - # from bottom to top - display_tween.tween_property(self, "position:y", 0.0, 0.5).set_trans(Tween.TRANS_CUBIC) - # unlock items after display - display_tween.tween_callback(_toggle_items_lock.bind(false)) - else: - position.y = 0 - _toggle_items_lock(false) - else: - # lock items before hide - _toggle_items_lock(true) - if use_tween: - display_tween = create_tween() - # from top to bottom - display_tween.tween_property(self, "position:y", 320.0, 0.5).set_trans( - Tween.TRANS_CUBIC - ) - else: - position.y = 320.0 - - -func _toggle_items_lock(lock: bool) -> void: - for v in items_dict.values(): - v.locked = lock - - -func _unhandled_input(event: InputEvent) -> void: - if event.is_action_pressed("toggle_journal"): - if locked: - # TODO 使用 icon,去重 - SceneManager.pop_notification("🔒") - return - display = !display - get_viewport().set_input_as_handled() diff --git a/scene/journal/journal.gd.uid b/scene/journal/journal.gd.uid deleted file mode 100644 index 0480e64c..00000000 --- a/scene/journal/journal.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bof32xnhs1xve diff --git a/scene/journal/journal.tscn b/scene/journal/journal.tscn deleted file mode 100644 index dceed51a..00000000 --- a/scene/journal/journal.tscn +++ /dev/null @@ -1,51 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://cvbt5qm70cg7t"] - -[ext_resource type="Texture2D" uid="uid://hmevnsvjteff" path="res://asset/art/ui/journal.png" id="1_l07pp"] -[ext_resource type="Script" uid="uid://bof32xnhs1xve" path="res://scene/journal/journal.gd" id="1_y2537"] -[ext_resource type="Texture2D" uid="uid://bxvfd8xk3cxn3" path="res://asset/art/little_game/八音盒/有按钮.png" id="2_3e7j3"] - -[node name="Journal" type="CanvasLayer"] -layer = 20 - -[node name="JournalRoot" type="Control" parent="."] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_top = 320.0 -offset_bottom = 320.0 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 2 -script = ExtResource("1_y2537") -tip_content = "哆莱米发索拉西123456789" - -[node name="JournalPage" type="TextureRect" parent="JournalRoot"] -show_behind_parent = true -layout_mode = 0 -offset_right = 40.0 -offset_bottom = 40.0 -rotation = 0.00704862 -mouse_filter = 2 -texture = ExtResource("1_l07pp") - -[node name="EntityPic" type="TextureRect" parent="JournalRoot"] -layout_mode = 0 -offset_left = 138.0 -offset_top = 67.0 -offset_right = 702.0 -offset_bottom = 307.0 -rotation = 0.00262768 -scale = Vector2(0.249104, 0.24444) -mouse_filter = 2 -texture = ExtResource("2_3e7j3") - -[node name="Tips" type="GridContainer" parent="JournalRoot"] -layout_mode = 1 -offset_left = 262.0 -offset_top = 50.0 -offset_right = 382.0 -offset_bottom = 90.0 -columns = 12 - -[node name="ItemsRoot" type="Node2D" parent="JournalRoot"] diff --git a/scene/journal/journal_item.gd b/scene/journal/journal_item.gd deleted file mode 100644 index 9289855c..00000000 --- a/scene/journal/journal_item.gd +++ /dev/null @@ -1,107 +0,0 @@ -extends CharacterBody2D - -@export var locked := false: - set(val): - locked = val - if locked: - listening = false - dragging = false - mouse_inside = false - if is_node_ready(): - $CollisionShape2D.disabled = locked -@export var label_text := "角": - set(val): - label_text = val - if is_node_ready(): - $Label.text = label_text -@export var boundart_rect := Rect2(0, 0, 1000, 1000) - -static var occupied := false -static var mutex := Mutex.new() -var target_position := Vector2() - -# draggable -var listening := false -var mouse_inside := false -var dragging := false: - set(val): - if dragging == val: - return - var success = false - if val: - mutex.lock() - dragging = !occupied - if dragging: - success = true - occupied = true - Input.set_default_cursor_shape(Input.CURSOR_DRAG) - mutex.unlock() - else: - mutex.lock() - if dragging: - dragging = false - occupied = false - Input.set_default_cursor_shape(Input.CURSOR_ARROW) - mutex.unlock() - if success: - _move_front() - - -func _ready(): - $CollisionShape2D.disabled = locked - $Label.text = label_text - target_position = global_position - mouse_entered.connect(_on_mouse_entered) - mouse_exited.connect(_on_mouse_exited) - - -func _move_front(): - var parent = get_parent() - if not parent: - return - parent.move_child(self, parent.get_child_count() - 1) - - -func _on_mouse_entered(): - listening = true - mouse_inside = true - - -func _on_mouse_exited(): - mouse_inside = false - if not dragging: - listening = false - - -func _physics_process(_delta: float) -> void: - if not locked and not dragging: - move_and_slide() - _clamp_position() - target_position = position - - -func _unhandled_input(event: InputEvent) -> void: - if locked or not listening: - return - if event is InputEventMouseButton: - if event.button_index == MOUSE_BUTTON_LEFT: - if dragging and not mouse_inside: - listening = false - dragging = false - else: - dragging = event.pressed - - if dragging and event is InputEventMouseMotion: - var new_pos = event.position - target_position = new_pos - position = target_position - _clamp_position() - - -func _clamp_position(): - position.x = clamp( - position.x, boundart_rect.position.x, boundart_rect.position.x + boundart_rect.size.x - ) - position.y = clamp( - position.y, boundart_rect.position.y, boundart_rect.position.y + boundart_rect.size.y - ) diff --git a/scene/journal/journal_item.gd.uid b/scene/journal/journal_item.gd.uid deleted file mode 100644 index f6f5cc86..00000000 --- a/scene/journal/journal_item.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://cflf7yk80aujt diff --git a/scene/journal/journal_item.tscn b/scene/journal/journal_item.tscn deleted file mode 100644 index 6dc77482..00000000 --- a/scene/journal/journal_item.tscn +++ /dev/null @@ -1,44 +0,0 @@ -[gd_scene load_steps=5 format=3 uid="uid://c02f7iylaxl75"] - -[ext_resource type="Script" uid="uid://cflf7yk80aujt" path="res://scene/journal/journal_item.gd" id="1_v5jv8"] -[ext_resource type="Texture2D" uid="uid://bqv7aaj4nm62n" path="res://asset/art/ui/chess.png" id="2_aol7i"] - -[sub_resource type="AtlasTexture" id="AtlasTexture_l31y8"] -atlas = ExtResource("2_aol7i") -region = Rect2(7, 0, 28, 26) - -[sub_resource type="CircleShape2D" id="CircleShape2D_w4qy1"] -radius = 12.0 - -[node name="JournalItem" type="CharacterBody2D"] -collision_layer = 16 -collision_mask = 16 -input_pickable = true -motion_mode = 1 -platform_wall_layers = 32 -script = ExtResource("1_v5jv8") -locked = null -label_text = null -boundart_rect = null - -[node name="Sprite2D" type="Sprite2D" parent="."] -texture = SubResource("AtlasTexture_l31y8") - -[node name="Label" type="Label" parent="."] -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -6.0 -offset_top = -7.0 -offset_right = 34.0 -offset_bottom = 8.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_horizontal = 4 -theme_override_colors/font_color = Color(0.212185, 0.145932, 0.00506154, 1) -text = "角" - -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] -shape = SubResource("CircleShape2D_w4qy1") diff --git a/scene/journal/journal_tip.gd b/scene/journal/journal_tip.gd deleted file mode 100644 index 7e035573..00000000 --- a/scene/journal/journal_tip.gd +++ /dev/null @@ -1,6 +0,0 @@ -extends Button - - -func _draw() -> void: - if button_pressed: - draw_circle(Vector2(9, 9), 6, Color(0, 0.5, 0, 0.5)) diff --git a/scene/journal/journal_tip.gd.uid b/scene/journal/journal_tip.gd.uid deleted file mode 100644 index 4cc081b3..00000000 --- a/scene/journal/journal_tip.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://vvndmwg22qp2 diff --git a/scene/little_game/弹珠游戏/ball.gd b/scene/little_game/弹珠游戏/ball.gd index 7556b0a5..dede1c72 100644 --- a/scene/little_game/弹珠游戏/ball.gd +++ b/scene/little_game/弹珠游戏/ball.gd @@ -3,6 +3,7 @@ extends RigidBody2D signal hit_ball +signal hit_ball_callback signal hit_boundary @export_enum("1", "2", "3", "4", "5", "6", "7") var id := "1": @@ -60,6 +61,10 @@ func hide_away(): visible = false collision_shape.disabled = true +func ease_out(): + collision_shape.disabled = true + create_tween().tween_property(self, "modulate:a", 0.0, 0.5) + func rand_id(): # 随机 id @@ -83,13 +88,14 @@ func _on_body_entered(node: Node): recycling = true var tween = create_tween() if node is StaticBody2D: - tween.tween_property(sprite2d, "modulate:a", 0.0, 1.0) + tween.tween_property(self, "modulate:a", 0.0, 1.0) tween.tween_callback(hit_boundary.emit) tween.tween_callback(queue_free) return - tween.tween_property(sprite2d, "modulate:a", 0.0, 1.5) - tween.parallel().tween_property(node.sprite2d, "modulate:a", 0.0, 1.5) - tween.tween_callback(hit_ball.emit) + hit_ball.emit() + tween.tween_property(self, "modulate:a", 0.0, 1.5) + tween.parallel().tween_property(node, "modulate:a", 0.0, 1.5) + tween.tween_callback(hit_ball_callback.emit) tween.tween_callback(node.queue_free) tween.tween_callback(queue_free) diff --git a/scene/little_game/弹珠游戏/弹珠游戏.gd b/scene/little_game/弹珠游戏/弹珠游戏.gd index cea20d0e..3483c4b9 100644 --- a/scene/little_game/弹珠游戏/弹珠游戏.gd +++ b/scene/little_game/弹珠游戏/弹珠游戏.gd @@ -5,8 +5,10 @@ signal exit(success) @onready var animation_player = $AnimationPlayer as AnimationPlayer @onready var pivot = $Pivot as Node2D @onready var hand_pivot = $Pivot/HandPivot as Node2D -@onready var audio_player = %AudioStreamPlayer as AudioStreamPlayer @onready var label = %RichTextLabel as RichTextLabel +@onready var audio_player = %AudioStreamPlayer as AudioStreamPlayer +@onready var sfx_hit = $SfxHit as Sfx +@onready var sfx_shoot = $SfxShoot as Sfx var dialogue_c02 = preload("res://asset/dialogue/c02.dialogue") @@ -118,6 +120,7 @@ func reload_hand_ball() -> void: ball.name = "Ball" # ball.rand_id() ball.hit_ball.connect(_on_hit_ball) + ball.hit_ball_callback.connect(_on_hit_ball_callback) ball.hit_boundary.connect(_on_hit_boundary) @@ -128,6 +131,9 @@ func wave_hand() -> void: hand_pivot.visible = true if hand_pivot.modulate.a < 1: create_tween().tween_property(hand_pivot, "modulate:a", 1.0, 0.5) + # var hand_ball = pivot.get_child(0) + # if hand_ball.modulate.a < 1: + # create_tween().tween_property(hand_ball, "modulate:a", 1.0, 0.5) # 转动 pivot if wave_tween: if not wave_tween.is_running(): @@ -167,9 +173,10 @@ func shoot() -> void: if not round_ready or shooting or round_id < 0: return shooting = true + sfx_shoot.play() # 触发射击事件 if wave_tween and wave_tween.is_running(): - wave_tween.stop() + wave_tween.pause() var ball = pivot.get_child(0) as RigidBody2D var direction = Vector2(0, -1).rotated(hand_pivot.rotation) ball.linear_velocity = direction * 200 @@ -178,7 +185,11 @@ func shoot() -> void: func _on_hit_ball(): - print("_on_hit_ball") + sfx_hit.play() + sfx_shoot.stop() + + +func _on_hit_ball_callback(): reload_hand_ball() hit_count += 1 if round_id == 0: @@ -210,8 +221,10 @@ func _success_dialogue(): func _on_hit_boundary(): + sfx_shoot.stop() if round_id > 0: # 后面的回合必须每次都击中球 + get_tree().call_group("Balls" + str(round_id), "ease_out") DialogueManager.show_dialogue_balloon_scene(self, dialogue_c02, "c02_弹珠游戏fail") await dialogue_ended reload_round() diff --git a/scene/little_game/弹珠游戏/弹珠游戏.tscn b/scene/little_game/弹珠游戏/弹珠游戏.tscn index 5e6d0bac..1154759b 100644 --- a/scene/little_game/弹珠游戏/弹珠游戏.tscn +++ b/scene/little_game/弹珠游戏/弹珠游戏.tscn @@ -1,13 +1,17 @@ -[gd_scene load_steps=18 format=3 uid="uid://cjx7o685ox8c1"] +[gd_scene load_steps=23 format=3 uid="uid://cjx7o685ox8c1"] [ext_resource type="Script" uid="uid://c5s4giu182isu" path="res://scene/little_game/弹珠游戏/弹珠游戏.gd" id="1_p2trd"] [ext_resource type="Texture2D" uid="uid://bvf8b057baglw" path="res://asset/art/little_game/弹珠/bg_弹珠游戏.png" id="2_bm1k0"] [ext_resource type="Texture2D" uid="uid://bs4tp4amd1kkm" path="res://asset/art/little_game/弹珠/抱手.png" id="3_3kvx4"] +[ext_resource type="AudioStream" uid="uid://bb6njoaxi2hbx" path="res://asset/audio/sfx/game/弹珠游戏/hit.ogg" id="3_co06r"] [ext_resource type="PackedScene" uid="uid://bbcfjksjlyfx5" path="res://scene/little_game/弹珠游戏/ball.tscn" id="4_bm1k0"] +[ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/general/sfx.gd" id="4_co06r"] [ext_resource type="Texture2D" uid="uid://btplp6xvmc6sx" path="res://asset/art/little_game/弹珠/手屈伸/0.png" id="4_fk3jp"] [ext_resource type="Texture2D" uid="uid://cny2ovcg2ry7c" path="res://asset/art/little_game/弹珠/瞄准线.png" id="4_plt4v"] +[ext_resource type="AudioStream" uid="uid://dcef4son60cs7" path="res://asset/audio/sfx/game/弹珠游戏/drop.ogg" id="5_co06r"] [ext_resource type="Texture2D" uid="uid://jv6fjt5fa68l" path="res://asset/art/little_game/弹珠/手屈伸/1.png" id="5_dowov"] [ext_resource type="PackedScene" uid="uid://d0tuv2dtlosfe" path="res://scene/little_game/弹珠游戏/balls_0.tscn" id="5_obeip"] +[ext_resource type="AudioStream" uid="uid://beijvb65selr5" path="res://asset/audio/sfx/game/弹珠游戏/loop.ogg" id="6_ctokx"] [ext_resource type="PackedScene" uid="uid://cv12saxinfoi7" path="res://scene/little_game/弹珠游戏/balls_1.tscn" id="6_ymk37"] [ext_resource type="PackedScene" uid="uid://dr0rwr0xjgnjw" path="res://scene/little_game/弹珠游戏/balls_2.tscn" id="7_oii6q"] [ext_resource type="PackedScene" uid="uid://cbpy56epwth0j" path="res://scene/little_game/弹珠游戏/balls_falling.tscn" id="8_fk3jp"] @@ -212,6 +216,24 @@ _data = { &"give_ball": SubResource("Animation_dowov") } +[sub_resource type="AudioStreamInteractive" id="AudioStreamInteractive_aqxy0"] +clip_count = 2 +clip_0/name = &"Drop" +clip_0/stream = ExtResource("5_co06r") +clip_0/auto_advance = 1 +clip_0/next_clip = 1 +clip_1/name = &"Loop" +clip_1/stream = ExtResource("6_ctokx") +clip_1/auto_advance = 0 +_transitions = { +Vector2i(1, 1): { +"fade_beats": 1.0, +"fade_mode": 4, +"from_time": 3, +"to_time": 1 +} +} + [sub_resource type="SpriteFrames" id="SpriteFrames_jur7x"] animations = [{ "frames": [{ @@ -277,6 +299,20 @@ libraries = { &"": SubResource("AnimationLibrary_fk3jp") } +[node name="SfxHit" type="AudioStreamPlayer" parent="."] +stream = ExtResource("3_co06r") +bus = &"game_sfx" +script = ExtResource("4_co06r") +file = "" +metadata/_custom_type_script = "uid://rq6w1vuhuq1m" + +[node name="SfxShoot" type="AudioStreamPlayer" parent="."] +stream = SubResource("AudioStreamInteractive_aqxy0") +bus = &"game_sfx" +script = ExtResource("4_co06r") +file = "" +metadata/_custom_type_script = "uid://rq6w1vuhuq1m" + [node name="Boy" type="Node2D" parent="."] z_index = 1 diff --git a/scene/main.tscn b/scene/main.tscn index 575a7239..0acd47a7 100644 --- a/scene/main.tscn +++ b/scene/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=3 uid="uid://dygvcmykn02n8"] +[gd_scene load_steps=8 format=3 uid="uid://dygvcmykn02n8"] [ext_resource type="Script" uid="uid://jn2alpdl4eal" path="res://scene/main.gd" id="1_pks84"] [ext_resource type="PackedScene" uid="uid://dc778gsjfr3ky" path="res://scene/prop/prop_hud.tscn" id="4_t7gb2"] @@ -7,7 +7,6 @@ [ext_resource type="Environment" uid="uid://c6ri8tn5qt6fe" path="res://scene/ground/environment.tres" id="9_jsof5"] [ext_resource type="PackedScene" uid="uid://beok2r6fgburn" path="res://scene/settings/settings.tscn" id="9_muu0b"] [ext_resource type="PackedScene" uid="uid://clxgkj80yin2" path="res://scene/ground/ground_loader.tscn" id="10_8rc5n"] -[ext_resource type="PackedScene" uid="uid://cvbt5qm70cg7t" path="res://scene/journal/journal.tscn" id="10_durpa"] [node name="Main" type="Node2D"] script = ExtResource("1_pks84") @@ -66,9 +65,6 @@ item_key = "prop_令牌" display_time = 1.5 metadata/_edit_use_anchors_ = true -[node name="Journal" parent="." instance=ExtResource("10_durpa")] -visible = false - [node name="Settings" parent="." instance=ExtResource("9_muu0b")] unique_name_in_owner = true visible = false