1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 15:01:53 +08:00

Add laser sound effect and implement BigLaser bullet behavior

- Added laserbig.ogg sound effect import configuration.
- Created BigLaser script extending BulletBase with AI targeting and dot application functionality.
This commit is contained in:
2025-08-27 19:59:05 +08:00
parent 561e12398a
commit a688fe3b44
12 changed files with 102 additions and 13 deletions
+39 -2
View File
@@ -1,5 +1,42 @@
[gd_scene load_steps=2 format=3 uid="uid://c8odsyb7xsu3i"]
[gd_scene load_steps=7 format=3 uid="uid://e7ci24ysgbyg"]
[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_cqnkd"]
[ext_resource type="Script" path="res://scripts/Contents/Bullets/BigLaser.gd" id="2_oqfvl"]
[ext_resource type="Shader" path="res://shaders/Laser.gdshader" id="3_25t1x"]
[node name="BulletBase" instance=ExtResource("1_cqnkd")]
[sub_resource type="SpriteFrames" id="SpriteFrames_yip5k"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_5n8cv"]
shader = ExtResource("3_25t1x")
shader_parameter/color = Color(0.823162, 0.116294, 1.92523e-07, 1)
shader_parameter/laser_width = 0.01
shader_parameter/soft_edge = 0.5
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_y85id"]
radius = 40.0
height = 1000.0
[node name="BigLaser" instance=ExtResource("1_cqnkd")]
script = ExtResource("2_oqfvl")
fields = {
0: 0,
1: 15,
2: 1
}
lifeTime = 5000.0
needEnergy = 50.0
[node name="texture" parent="." index="0"]
rotation = 1.5708
sprite_frames = SubResource("SpriteFrames_yip5k")
[node name="rect" type="ColorRect" parent="texture" index="0"]
material = SubResource("ShaderMaterial_5n8cv")
offset_left = -40.0
offset_top = -1000.0
offset_right = 40.0
[node name="hitbox" parent="." index="1"]
position = Vector2(500, 0)
rotation = 1.5708
shape = SubResource("CapsuleShape2D_y85id")
+1 -1
View File
@@ -35,7 +35,7 @@ script = ExtResource("2_r6bub")
cooldownUnit = 3000.0
displayName = "小鸡"
drops = Array[int]([0, 1])
dropCounts = Array[Vector2]([Vector2(10, 20), Vector2(7, 14)])
dropCounts = Array[Vector2]([Vector2(10, 30), Vector2(15, 50)])
appleCount = Vector2i(2, 6)
energy = 1000.0
+5 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=3 uid="uid://bm7ymrri6pykb"]
[gd_scene load_steps=13 format=3 uid="uid://bm7ymrri6pykb"]
[ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_e5pl8"]
[ext_resource type="Script" path="res://scripts/Contents/Characters/Rooster.gd" id="2_oqdqd"]
@@ -9,6 +9,7 @@
[ext_resource type="AudioStream" uid="uid://benyec5bqni0b" path="res://resources/sounds/effect/Chomp.wav" id="4_k0yme"]
[ext_resource type="AudioStream" uid="uid://dmxh3bpk8vyy5" path="res://resources/sounds/effect/Coin.mp3" id="5_xnbhq"]
[ext_resource type="AudioStream" uid="uid://4wuuf1osk0yv" path="res://resources/sounds/effect/Low Boing.wav" id="6_m5px1"]
[ext_resource type="AudioStream" uid="uid://q65xjxxq1m4j" path="res://resources/sounds/effect/laserbig.ogg" id="8_pssdt"]
[sub_resource type="SpriteFrames" id="SpriteFrames_4v2ol"]
animations = [{
@@ -55,6 +56,9 @@ stream = ExtResource("6_m5px1")
[node name="attack0" parent="sounds" index="4"]
stream = ExtResource("3_4syso")
[node name="attack1" type="AudioStreamPlayer2D" parent="sounds" index="5"]
stream = ExtResource("8_pssdt")
[node name="texture" parent="." index="1"]
position = Vector2(0, -70)
sprite_frames = SubResource("SpriteFrames_4v2ol")
+3 -3
View File
@@ -6,10 +6,10 @@
[node name="Cake" instance=ExtResource("1_f2mv8")]
avatarTexture = ExtResource("2_ijk6h")
displayName = "生日蛋糕"
fields = Array[int]([4, 8])
fieldValues = Array[float]([0.06, 0.075])
fields = Array[int]([4, 8, 15])
fieldValues = Array[float]([0.06, 0.075, 1.0])
costs = Array[int]([1])
costCounts = Array[int]([70])
costCounts = Array[int]([125])
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_ijk6h")
+4 -4
View File
@@ -6,10 +6,10 @@
[node name="Donut" instance=ExtResource("1_7gqm6")]
avatarTexture = ExtResource("2_bv6j5")
displayName = "甜甜圈"
fields = Array[int]([9, 7])
fieldValues = Array[float]([1.0, -3.0])
costs = Array[int]([0])
costCounts = Array[int]([100])
fields = Array[int]([9, 7, 16])
fieldValues = Array[float]([1.0, -3.0, 1.0])
costs = Array[int]([0, 1])
costCounts = Array[int]([300, 100])
[node name="name" parent="container/info" index="1"]
text = "[b]甜甜圈[/b]"
+5
View File
@@ -61,6 +61,11 @@ heal={
"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":82,"key_label":0,"unicode":114,"location":0,"echo":false,"script":null)
]
}
attack2={
"deadzone": 0.5,
"events": [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":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}
[physics]
Binary file not shown.
@@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://q65xjxxq1m4j"
path="res://.godot/imported/laserbig.ogg-c68f8d84676af4ccb64c68f85992ce2d.oggvorbisstr"
[deps]
source_file="res://resources/sounds/effect/laserbig.ogg"
dest_files=["res://.godot/imported/laserbig.ogg-c68f8d84676af4ccb64c68f85992ce2d.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
+12
View File
@@ -0,0 +1,12 @@
extends BulletBase
class_name BigLaser
func ai():
rotation = (get_global_mouse_position() - position).angle()
position = launcher.texture.global_position
func applyDot():
hitbox.disabled = true
await TickTool.millseconds(50)
hitbox.disabled = false
await TickTool.millseconds(50)
return true
+7 -1
View File
@@ -11,7 +11,11 @@ func ai():
if direction.length() == 0:
texture.play("idle")
if Input.is_action_pressed("attack"):
cooldownUnit = 200
tryAttack(0)
elif Input.is_action_pressed("attack2"):
cooldownUnit = 6000
tryAttack(1)
if Input.is_action_just_pressed("sprint"):
trySprint()
if Input.is_action_just_pressed("heal"):
@@ -19,8 +23,10 @@ func ai():
func attack(type):
if type == 0:
var weaponPos = findWeaponAnchor("normal")
# return BulletBase.generate(preload("res://components/Bullets/Pencil.tscn"), self, weaponPos, (get_global_mouse_position() - weaponPos).angle())
return BulletBase.generate(preload("res://components/Bullets/PurpleCrystal.tscn"), self, weaponPos, (get_global_mouse_position() - weaponPos).angle())
elif type == 1:
var weaponPos = findWeaponAnchor("normal")
return BulletBase.generate(preload("res://components/Bullets/BigLaser.tscn"), self, weaponPos, (get_global_mouse_position() - weaponPos).angle())
func sprint():
move(Vector2(
Input.get_axis("m_left", "m_right"),
+6
View File
@@ -32,6 +32,7 @@ func _ready():
await animator.animation_finished
if autoLoopAnimation:
animator.play("loop")
dotLoop()
func _process(_delta: float) -> void:
if lifeTime > 0:
if Time.get_ticks_msec() - spawnInWhen >= lifeTime:
@@ -60,6 +61,9 @@ func fullPenerate():
return fields.get(FieldStore.Bullet.PENERATE) + launcher.fields.get(FieldStore.Entity.PENERATE)
func timeLived():
return Time.get_ticks_msec() - spawnInWhen
func dotLoop():
if await applyDot():
await dotLoop()
func ai():
pass
@@ -67,6 +71,8 @@ func destroy():
queue_free()
func spawn():
pass
func applyDot():
pass
static func generate(
bullet: PackedScene,
+1 -1
View File
@@ -83,7 +83,7 @@ func _physics_process(_delta: float) -> void:
if isPlayer() or is_instance_valid(currentFocusedBoss):
ai()
move_and_slide()
storeEnergy(0.05)
storeEnergy(0.01)
# 通用方法
func displace(direction: Vector2, isSprinting: bool = false):