mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-27 14:02:29 +08:00
feat(角色): 添加狗角色音效和攻击冷却随机化
添加狗角色的受伤音效文件并配置导入设置 修改狗的攻击冷却时间为3000-5000毫秒随机值 调整狗角色的受伤音效播放几率为30% 为狗角色添加碰撞检测形状
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://bb363wvwvs7m4"]
|
[gd_scene load_steps=9 format=3 uid="uid://bb363wvwvs7m4"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_cbgnh"]
|
[ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_cbgnh"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cew1kecisufy4" path="res://resources/characters/dog/hsq.png" id="2_oospf"]
|
[ext_resource type="Texture2D" uid="uid://cew1kecisufy4" path="res://resources/characters/dog/hsq.png" id="2_oospf"]
|
||||||
[ext_resource type="Script" uid="uid://soehdxfbpmc0" path="res://scripts/Contents/Characters/Dog.gd" id="2_pb36u"]
|
[ext_resource type="Script" uid="uid://soehdxfbpmc0" path="res://scripts/Contents/Characters/Dog.gd" id="2_pb36u"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://cgnqvldnkxjtr" path="res://resources/sounds/effect/doghurt2.wav" id="3_tn3v8"]
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_pb36u"]
|
[sub_resource type="SpriteFrames" id="SpriteFrames_pb36u"]
|
||||||
animations = [{
|
animations = [{
|
||||||
@@ -28,9 +29,19 @@ animations = [{
|
|||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_e644g"]
|
||||||
|
size = Vector2(118, 64)
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_s2gll"]
|
||||||
|
radius = 27.018513
|
||||||
|
|
||||||
[node name="Dog" instance=ExtResource("1_cbgnh")]
|
[node name="Dog" instance=ExtResource("1_cbgnh")]
|
||||||
script = ExtResource("2_pb36u")
|
script = ExtResource("2_pb36u")
|
||||||
displayName = "哈士奇"
|
displayName = "哈士奇"
|
||||||
|
hurtAudioRate = 0.3
|
||||||
|
|
||||||
|
[node name="hurt" parent="sounds" index="3"]
|
||||||
|
stream = ExtResource("3_tn3v8")
|
||||||
|
|
||||||
[node name="texture" parent="." index="3"]
|
[node name="texture" parent="." index="3"]
|
||||||
sprite_frames = SubResource("SpriteFrames_pb36u")
|
sprite_frames = SubResource("SpriteFrames_pb36u")
|
||||||
@@ -41,6 +52,14 @@ scale = Vector2(0.35093215, 0.35093215)
|
|||||||
sprite_frames = SubResource("SpriteFrames_tn3v8")
|
sprite_frames = SubResource("SpriteFrames_tn3v8")
|
||||||
animation = &"idle"
|
animation = &"idle"
|
||||||
|
|
||||||
|
[node name="hitbox" parent="texture/hurtbox" index="0"]
|
||||||
|
position = Vector2(-14, -22)
|
||||||
|
shape = SubResource("RectangleShape2D_e644g")
|
||||||
|
|
||||||
|
[node name="hitbox2" type="CollisionShape2D" parent="texture/hurtbox" index="1"]
|
||||||
|
position = Vector2(46, -51)
|
||||||
|
shape = SubResource("CircleShape2D_s2gll")
|
||||||
|
|
||||||
[node name="normal" type="Node2D" parent="texture/weapons" index="0"]
|
[node name="normal" type="Node2D" parent="texture/weapons" index="0"]
|
||||||
position = Vector2(53, -35)
|
position = Vector2(53, -35)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamWAV"
|
||||||
|
uid="uid://dbpk7ggmbmtcw"
|
||||||
|
path="res://.godot/imported/Dog2.wav-8d0360a90ca9f9a3fdf75ac8b4c63ad6.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://resources/sounds/effect/Dog2.wav"
|
||||||
|
dest_files=["res://.godot/imported/Dog2.wav-8d0360a90ca9f9a3fdf75ac8b4c63ad6.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
|
||||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamWAV"
|
||||||
|
uid="uid://bu6kb41xpl0nx"
|
||||||
|
path="res://.godot/imported/doghurt.wav-0322a0a86f79b0dbfa9fd53259197b96.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://resources/sounds/effect/doghurt.wav"
|
||||||
|
dest_files=["res://.godot/imported/doghurt.wav-0322a0a86f79b0dbfa9fd53259197b96.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
|
||||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamWAV"
|
||||||
|
uid="uid://cgnqvldnkxjtr"
|
||||||
|
path="res://.godot/imported/doghurt2.wav-49befa9aa9ef77b97ab11c520f8eb9c1.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://resources/sounds/effect/doghurt2.wav"
|
||||||
|
dest_files=["res://.godot/imported/doghurt2.wav-49befa9aa9ef77b97ab11c520f8eb9c1.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
|
||||||
@@ -4,7 +4,7 @@ func register():
|
|||||||
fields[FieldStore.Entity.MAX_HEALTH] = 120
|
fields[FieldStore.Entity.MAX_HEALTH] = 120
|
||||||
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.2
|
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.2
|
||||||
fields[FieldStore.Entity.OFFSET_SHOOT] = 0
|
fields[FieldStore.Entity.OFFSET_SHOOT] = 0
|
||||||
attackCooldownMap[0] = 2000
|
attackCooldownMap[0] = randi_range(3000, 5000)
|
||||||
|
|
||||||
func ai():
|
func ai():
|
||||||
PresetEntityAI.follow(self, currentFocusedBoss, 300)
|
PresetEntityAI.follow(self, currentFocusedBoss, 300)
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ var inventoryMax = {
|
|||||||
@export var level: int = 1
|
@export var level: int = 1
|
||||||
@export var currentInvinsible: bool = false
|
@export var currentInvinsible: bool = false
|
||||||
@export var useStatic: bool = false
|
@export var useStatic: bool = false
|
||||||
|
@export var hurtAudioRate: float = 1
|
||||||
|
|
||||||
@onready var animatree: AnimationTree = $"%animatree"
|
@onready var animatree: AnimationTree = $"%animatree"
|
||||||
@onready var texture: AnimatedSprite2D = $"%texture"
|
@onready var texture: AnimatedSprite2D = $"%texture"
|
||||||
@@ -239,7 +240,8 @@ func takeDamage(bullet: BulletBase, crit: bool):
|
|||||||
storeEnergy(damage * 0.35)
|
storeEnergy(damage * 0.35)
|
||||||
damage = 0
|
damage = 0
|
||||||
else:
|
else:
|
||||||
playSound("hurt")
|
if MathTool.rate(hurtAudioRate):
|
||||||
|
playSound("hurt")
|
||||||
storeEnergy(damage * -0.5)
|
storeEnergy(damage * -0.5)
|
||||||
position += Vector2.from_angle(bullet.position.angle_to_point(position)) * bullet.knockback
|
position += Vector2.from_angle(bullet.position.angle_to_point(position)) * bullet.knockback
|
||||||
hit.emit(damage, bullet, crit)
|
hit.emit(damage, bullet, crit)
|
||||||
|
|||||||
Reference in New Issue
Block a user