mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
feat(角色): 为熊角色添加新的光枪攻击技能
添加新的光枪攻击类型(类型5),包括: - 新增光枪子弹预制体及脚本 - 添加光枪音效资源 - 在熊角色中实现光枪攻击逻辑 - 新增光枪轨迹着色器 - 配置攻击冷却时间为5500ms 光枪攻击会发射10-15发彩色追踪子弹,形成环绕效果
This commit is contained in:
@@ -0,0 +1,187 @@
|
|||||||
|
[gd_scene load_steps=20 format=3 uid="uid://chlefxyj2ood"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_kwotu"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/Contents/Bullets/BossAttack/Bear/LightGun.gd" id="2_jid6s"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/Statemachine/ShaderStage.gd" id="3_or7kk"]
|
||||||
|
[ext_resource type="Shader" path="res://shaders/LightTrack.gdshader" id="3_spbey"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cf065c7jjufq" path="res://resources/bullets/light-express/Ethereal_Lance.webp" id="5_bepne"]
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_ep4dl"]
|
||||||
|
offsets = PackedFloat32Array(0, 0.16, 0.32, 0.48, 0.64, 0.8, 1)
|
||||||
|
colors = PackedColorArray(1, 0, 0, 1, 1, 0.447059, 0, 1, 1, 0.890625, 0, 1, 0, 0.820313, 0.128174, 1, 0, 1, 0.859375, 1, 0, 0.53125, 1, 1, 0.429688, 0, 1, 1)
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture1D" id="GradientTexture1D_aqmnp"]
|
||||||
|
gradient = SubResource("Gradient_ep4dl")
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_ufqp1"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "bezier"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("track:material:shader_parameter/color:a")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"handle_modes": PackedInt32Array(0),
|
||||||
|
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
|
||||||
|
"times": PackedFloat32Array(0)
|
||||||
|
}
|
||||||
|
tracks/1/type = "bezier"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("sword:position:x")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"handle_modes": PackedInt32Array(0),
|
||||||
|
"points": PackedFloat32Array(-1000, -0.25, 0, 0.25, 0),
|
||||||
|
"times": PackedFloat32Array(0)
|
||||||
|
}
|
||||||
|
tracks/2/type = "bezier"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("%hitbox:position:x")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"handle_modes": PackedInt32Array(0),
|
||||||
|
"points": PackedFloat32Array(-1000, -0.25, 0, 0.25, 0),
|
||||||
|
"times": PackedFloat32Array(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_oinqg"]
|
||||||
|
resource_name = "destroy"
|
||||||
|
length = 0.5
|
||||||
|
step = 0.1
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_ynxlt"]
|
||||||
|
resource_name = "loop"
|
||||||
|
loop_mode = 1
|
||||||
|
step = 0.1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:rotation")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [0.0, 6.28319]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_kmogx"]
|
||||||
|
resource_name = "spawn"
|
||||||
|
length = 3.0
|
||||||
|
step = 0.05
|
||||||
|
tracks/0/type = "bezier"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("track:material:shader_parameter/color:a")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"handle_modes": PackedInt32Array(0, 0, 0, 0),
|
||||||
|
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0),
|
||||||
|
"times": PackedFloat32Array(0, 0.5, 2.5, 3)
|
||||||
|
}
|
||||||
|
tracks/1/type = "bezier"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("sword:position:x")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"handle_modes": PackedInt32Array(0, 0),
|
||||||
|
"points": PackedFloat32Array(-1000, -0.25, 0, 0.25, 0, 1000, -0.25, 0, 0.25, 0),
|
||||||
|
"times": PackedFloat32Array(2.5, 3)
|
||||||
|
}
|
||||||
|
tracks/2/type = "bezier"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("%hitbox:position:x")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"handle_modes": PackedInt32Array(0, 0),
|
||||||
|
"points": PackedFloat32Array(-1000, -0.25, 0, 0.25, 0, 1000, -0.25, 0, 0.25, 0),
|
||||||
|
"times": PackedFloat32Array(2.5, 3)
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_d5b1d"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_ufqp1"),
|
||||||
|
"destroy": SubResource("Animation_oinqg"),
|
||||||
|
"loop": SubResource("Animation_ynxlt"),
|
||||||
|
"spawn": SubResource("Animation_kmogx")
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_sjtia"]
|
||||||
|
shader = ExtResource("3_spbey")
|
||||||
|
shader_parameter/color = Color(1, 1, 1, 0)
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_h144l"]
|
||||||
|
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||||
|
point_count = 2
|
||||||
|
|
||||||
|
[sub_resource type="CurveTexture" id="CurveTexture_iq806"]
|
||||||
|
curve = SubResource("Curve_h144l")
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_cbjl2"]
|
||||||
|
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||||
|
point_count = 2
|
||||||
|
|
||||||
|
[sub_resource type="CurveTexture" id="CurveTexture_mqm5w"]
|
||||||
|
curve = SubResource("Curve_cbjl2")
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_ppc2o"]
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
direction = Vector3(-1, 0, 0)
|
||||||
|
spread = 180.0
|
||||||
|
initial_velocity_min = 20.0
|
||||||
|
initial_velocity_max = 20.0
|
||||||
|
gravity = Vector3(0, 0, 0)
|
||||||
|
scale_min = 3.0
|
||||||
|
scale_max = 5.0
|
||||||
|
scale_curve = SubResource("CurveTexture_mqm5w")
|
||||||
|
alpha_curve = SubResource("CurveTexture_iq806")
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_3olw7"]
|
||||||
|
radius = 6.0
|
||||||
|
height = 118.0
|
||||||
|
|
||||||
|
[node name="LightGun" instance=ExtResource("1_kwotu")]
|
||||||
|
script = ExtResource("2_jid6s")
|
||||||
|
allColor = SubResource("GradientTexture1D_aqmnp")
|
||||||
|
displayName = "空灵长枪"
|
||||||
|
autoSpawnAnimation = true
|
||||||
|
freeAfterSpawn = true
|
||||||
|
|
||||||
|
[node name="animator" parent="texture" index="0"]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_d5b1d")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="track" type="Node2D" parent="texture" index="1"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
material = SubResource("ShaderMaterial_sjtia")
|
||||||
|
script = ExtResource("3_or7kk")
|
||||||
|
size = Vector2(2000, 10)
|
||||||
|
|
||||||
|
[node name="sword" type="Sprite2D" parent="texture" index="2"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
position = Vector2(-1000, 0)
|
||||||
|
texture = ExtResource("5_bepne")
|
||||||
|
|
||||||
|
[node name="points" type="GPUParticles2D" parent="texture/sword" index="0"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
z_index = -1
|
||||||
|
position = Vector2(-55, 0)
|
||||||
|
amount = 50
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_ppc2o")
|
||||||
|
|
||||||
|
[node name="hitbox" parent="." index="1"]
|
||||||
|
position = Vector2(-1000, 0)
|
||||||
|
rotation = 1.5708
|
||||||
|
shape = SubResource("CapsuleShape2D_3olw7")
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=29 format=3 uid="uid://m60bwhdpbem8"]
|
[gd_scene load_steps=30 format=3 uid="uid://m60bwhdpbem8"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_3ves7"]
|
[ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_3ves7"]
|
||||||
[ext_resource type="Script" path="res://scripts/Contents/Characters/Bear.gd" id="2_kh2af"]
|
[ext_resource type="Script" path="res://scripts/Contents/Characters/Bear.gd" id="2_kh2af"]
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
[ext_resource type="AudioStream" uid="uid://ce8xjsh68momv" path="res://resources/sounds/bossAttack/Bear/Arrow7-2.ogg" id="7_0r2df"]
|
[ext_resource type="AudioStream" uid="uid://ce8xjsh68momv" path="res://resources/sounds/bossAttack/Bear/Arrow7-2.ogg" id="7_0r2df"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cli2fyulk3dsg" path="res://resources/characters/bear/bear-walk-f.svg" id="7_f0c6w"]
|
[ext_resource type="Texture2D" uid="uid://cli2fyulk3dsg" path="res://resources/characters/bear/bear-walk-f.svg" id="7_f0c6w"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dadi3ud01bqxk" path="res://resources/characters/bear/bear-walk-g.svg" id="8_4c7bp"]
|
[ext_resource type="Texture2D" uid="uid://dadi3ud01bqxk" path="res://resources/characters/bear/bear-walk-g.svg" id="8_4c7bp"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://dd18jfva1knwm" path="res://resources/sounds/bossAttack/Bear/LightGun.ogg" id="8_qagkm"]
|
||||||
[ext_resource type="Texture2D" uid="uid://017nthmejh3g" path="res://resources/characters/bear/bear-walk-h.svg" id="9_bcby1"]
|
[ext_resource type="Texture2D" uid="uid://017nthmejh3g" path="res://resources/characters/bear/bear-walk-h.svg" id="9_bcby1"]
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_6tgxs"]
|
[sub_resource type="SpriteFrames" id="SpriteFrames_6tgxs"]
|
||||||
@@ -127,6 +128,9 @@ stream = ExtResource("6_x3jmu")
|
|||||||
[node name="attack4" type="AudioStreamPlayer2D" parent="sounds" index="9"]
|
[node name="attack4" type="AudioStreamPlayer2D" parent="sounds" index="9"]
|
||||||
stream = ExtResource("7_0r2df")
|
stream = ExtResource("7_0r2df")
|
||||||
|
|
||||||
|
[node name="attack5" type="AudioStreamPlayer2D" parent="sounds" index="10"]
|
||||||
|
stream = ExtResource("8_qagkm")
|
||||||
|
|
||||||
[node name="texture" parent="." index="2"]
|
[node name="texture" parent="." index="2"]
|
||||||
position = Vector2(0, -80)
|
position = Vector2(0, -80)
|
||||||
sprite_frames = SubResource("SpriteFrames_6tgxs")
|
sprite_frames = SubResource("SpriteFrames_6tgxs")
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="oggvorbisstr"
|
||||||
|
type="AudioStreamOggVorbis"
|
||||||
|
uid="uid://dd18jfva1knwm"
|
||||||
|
path="res://.godot/imported/LightGun.ogg-0454fa522dc5c679f52b5e6b5334e763.oggvorbisstr"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://resources/sounds/bossAttack/Bear/LightGun.ogg"
|
||||||
|
dest_files=["res://.godot/imported/LightGun.ogg-0454fa522dc5c679f52b5e6b5334e763.oggvorbisstr"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
extends BulletBase
|
||||||
|
|
||||||
|
@export var allColor: GradientTexture1D = null
|
||||||
|
|
||||||
|
@onready var track: Node2D = $"%track"
|
||||||
|
@onready var sword: Sprite2D = $"%sword"
|
||||||
|
@onready var points: GPUParticles2D = $"%points"
|
||||||
|
|
||||||
|
var myColor: Color
|
||||||
|
func register():
|
||||||
|
speed = 1
|
||||||
|
damage = 5
|
||||||
|
penerate = 1
|
||||||
|
func spawn():
|
||||||
|
myColor = allColor.gradient.sample(randf())
|
||||||
|
track.material = track.material.duplicate()
|
||||||
|
points.process_material = points.process_material.duplicate()
|
||||||
|
setColor(myColor)
|
||||||
|
func setColor(color: Color):
|
||||||
|
track.material.set_shader_parameter("color", color)
|
||||||
|
sword.modulate = color
|
||||||
|
points.process_material.color = color
|
||||||
@@ -11,6 +11,7 @@ func register():
|
|||||||
attackCooldownMap[2] = 8000
|
attackCooldownMap[2] = 8000
|
||||||
attackCooldownMap[3] = 13000
|
attackCooldownMap[3] = 13000
|
||||||
attackCooldownMap[4] = 4500
|
attackCooldownMap[4] = 4500
|
||||||
|
attackCooldownMap[5] = 5500
|
||||||
sprintMultiplier = 60
|
sprintMultiplier = 60
|
||||||
func spawn():
|
func spawn():
|
||||||
texture.play("walk")
|
texture.play("walk")
|
||||||
@@ -18,6 +19,7 @@ func ai():
|
|||||||
PresetEntityAI.follow(self, currentFocusedBoss, 200)
|
PresetEntityAI.follow(self, currentFocusedBoss, 200)
|
||||||
for i in len(attackCooldownMap.keys()):
|
for i in len(attackCooldownMap.keys()):
|
||||||
tryAttack(i)
|
tryAttack(i)
|
||||||
|
# tryAttack(5)
|
||||||
func attack(type):
|
func attack(type):
|
||||||
var weaponPos = findWeaponAnchor("normal")
|
var weaponPos = findWeaponAnchor("normal")
|
||||||
if type == 0:
|
if type == 0:
|
||||||
@@ -57,6 +59,15 @@ func attack(type):
|
|||||||
bullet.tracer = currentFocusedBoss
|
bullet.tracer = currentFocusedBoss
|
||||||
await TickTool.millseconds(830.0 / count)
|
await TickTool.millseconds(830.0 / count)
|
||||||
return false
|
return false
|
||||||
|
elif type == 5:
|
||||||
|
var target = currentFocusedBoss.position
|
||||||
|
var count = randi_range(10, 15)
|
||||||
|
for i in range(count):
|
||||||
|
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/LightGun.tscn"), self, target, 0):
|
||||||
|
bullet.position += Vector2.from_angle(deg_to_rad(360.0 / count * i)) * 1000
|
||||||
|
bullet.rotation = bullet.position.angle_to_point(target)
|
||||||
|
await TickTool.millseconds(1670.0 / count)
|
||||||
|
return false
|
||||||
return true
|
return true
|
||||||
func sprint():
|
func sprint():
|
||||||
move(Vector2(sign((currentFocusedBoss.position - position).x * sprintMultiplier), 0), true)
|
move(Vector2(sign((currentFocusedBoss.position - position).x * sprintMultiplier), 0), true)
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
shader_type canvas_item;
|
||||||
|
uniform vec4 color:source_color;
|
||||||
|
void fragment() {
|
||||||
|
vec2 center=vec2(UV.x,0.5);
|
||||||
|
float maxDist=0.5;
|
||||||
|
float dist=distance(UV,center);
|
||||||
|
COLOR=color;
|
||||||
|
COLOR.a*=(maxDist-dist)/maxDist;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user