diff --git a/asset/art/gif/c03_胖子游戏/c03_棺材怪合并素材/c03_棺材怪合并素材_frames.tres b/asset/art/gif/c03_胖子游戏/c03_棺材怪合并素材/c03_棺材怪合并素材_frames.tres index f6b30d64..38a1aa01 100644 --- a/asset/art/gif/c03_胖子游戏/c03_棺材怪合并素材/c03_棺材怪合并素材_frames.tres +++ b/asset/art/gif/c03_胖子游戏/c03_棺材怪合并素材/c03_棺材怪合并素材_frames.tres @@ -95,38 +95,38 @@ animations = [{ "speed": 5.0 }, { "frames": [{ -"duration": 6.0, +"duration": 1.0, "texture": ExtResource("1_ddjd1") }, { -"duration": 6.0, +"duration": 1.0, "texture": ExtResource("2_1bfo3") }, { -"duration": 6.0, +"duration": 1.0, "texture": ExtResource("3_j1ego") }, { -"duration": 6.0, +"duration": 1.0, "texture": ExtResource("4_s55rn") }], "loop": false, "name": &"棺材怪右砍", -"speed": 30.0 +"speed": 5.0 }, { "frames": [{ -"duration": 6.0, +"duration": 1.0, "texture": ExtResource("5_2j3c0") }, { -"duration": 6.0, +"duration": 1.0, "texture": ExtResource("6_nysf7") }, { -"duration": 6.0, +"duration": 1.0, "texture": ExtResource("7_0vrf3") }, { -"duration": 6.0, +"duration": 1.0, "texture": ExtResource("8_g0hd4") }], "loop": false, "name": &"棺材怪左砍", -"speed": 30.0 +"speed": 5.0 }, { "frames": [{ "duration": 6.0, @@ -169,7 +169,7 @@ animations = [{ "duration": 6.0, "texture": ExtResource("2_0dcjf") }], -"loop": true, +"loop": false, "name": &"棺材怪移动", "speed": 30.0 }, { @@ -180,7 +180,7 @@ animations = [{ "duration": 6.0, "texture": ExtResource("20_pjkh2") }], -"loop": true, +"loop": false, "name": &"棺材怪移动右", "speed": 30.0 }, { diff --git a/scene/ground/scene/c03/s10_胖子游戏1.tscn b/scene/ground/scene/c03/s10_胖子游戏1.tscn index 3d51a962..a43dea27 100644 --- a/scene/ground/scene/c03/s10_胖子游戏1.tscn +++ b/scene/ground/scene/c03/s10_胖子游戏1.tscn @@ -828,7 +828,7 @@ self_modulate = Color(1, 1, 1, 0) z_index = -1 position = Vector2(3434, -17.5) sprite_frames = ExtResource("16_f57cq") -animation = &"棺材怪右砍" +animation = &"棺材怪左砍" script = ExtResource("9_js8ld") mute = true move_target = NodePath("../../DeployLayer/MonsterMoveTarget") diff --git a/scene/ground/script/c03/胖子游戏棺材怪.gd b/scene/ground/script/c03/胖子游戏棺材怪.gd index 29ddf66c..2da9a7ee 100644 --- a/scene/ground/script/c03/胖子游戏棺材怪.gd +++ b/scene/ground/script/c03/胖子游戏棺材怪.gd @@ -42,6 +42,8 @@ func _ready() -> void: left_area.body_entered.connect(_on_player_chopped) right_area.body_entered.connect(_on_player_chopped) _on_mute_updated() + if GlobalConfig.DEBUG: + animation_changed.connect(func(): print("animation changed:", animation)) func _on_mute_updated() -> void: @@ -76,10 +78,10 @@ func chop_left(aiming_duration := AIMING_DURATION) -> void: return hand_mode = 0 aiming += 1 - _checkout_hand_animation(false) var tween = create_tween() if aiming_duration > 0.0: tween.tween_property(remote_left_shadow, "scale", Vector2.ONE, aiming_duration) + tween.tween_callback(_checkout_hand_animation.bind(false)) tween.tween_callback(left_side_sprite.play) tween.tween_property(remote_left_side, "position:y", 0.0, 0.15) if aiming_duration <= 0.0: @@ -99,10 +101,10 @@ func chop_right(aiming_duration := AIMING_DURATION) -> void: return hand_mode = 1 aiming += 1 - _checkout_hand_animation(false) var tween = create_tween() if aiming_duration > 0.0: tween.tween_property(remote_right_shadow, "scale", Vector2.ONE, aiming_duration) + tween.tween_callback(_checkout_hand_animation.bind(false)) tween.tween_callback(right_side_sprite.play) tween.tween_property(remote_right_side, "position:y", 0.0, 0.15) if aiming_duration <= 0.0: @@ -152,7 +154,8 @@ func _physics_process(delta: float) -> void: target_x -= right_hand_x_offset var x = global_position.x if chopped_safe_period or abs(target_x - x) < 0.1: - stop() + if not playing_chopping_animation: + stop() if footstep_sfx.playing: footstep_sfx.stop() else: @@ -165,17 +168,22 @@ func _physics_process(delta: float) -> void: # prints(x, target_x) if not footstep_sfx.playing: footstep_sfx.play() - _checkout_hand_animation() + _checkout_hand_animation(true) +var playing_chopping_animation = false -func _checkout_hand_animation(is_move := true) -> void: +func _checkout_hand_animation(moving: bool) -> void: + if playing_chopping_animation: + return var target_animation = "" - if is_move: + if moving: target_animation = "棺材怪移动" if hand_mode == 0 else "棺材怪移动右" + if not is_playing(): + play(target_animation) else: + playing_chopping_animation = true target_animation = "棺材怪左砍" if hand_mode == 0 else "棺材怪右砍" - if not is_playing() or animation != target_animation: - if hand_mode == 0: - play(target_animation) - else: - play(target_animation) + if GlobalConfig.DEBUG: + prints("play chopping animation:", target_animation) + play(target_animation) + Util.timer(1.0, func(): playing_chopping_animation = false)