mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(战斗系统): 增强激光武器效果并添加击退机制
- 增加BigLaser的伤害值和能量消耗 - 为子弹添加击退效果和生成后自动释放功能 - 修改LaserPluse的动画参数并添加锁定发射器脚本 - 调整敌人受击时的能量获取和击退效果 - 更新波次生成配置
This commit is contained in:
@@ -20,11 +20,12 @@ height = 2000.0
|
||||
script = ExtResource("2_oqfvl")
|
||||
fields = {
|
||||
0: 0,
|
||||
1: 15,
|
||||
1: 25,
|
||||
2: 1
|
||||
}
|
||||
lifeTime = 5000.0
|
||||
needEnergy = 100.0
|
||||
needEnergy = 150.0
|
||||
knockback = 10.0
|
||||
|
||||
[node name="texture" parent="." index="0"]
|
||||
rotation = 1.5708
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bx4guw2vkxgw4"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://bx4guw2vkxgw4"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_k5wxk"]
|
||||
[ext_resource type="Texture2D" uid="uid://ry8d7pst4ihf" path="res://resources/bullets/laser-pluse/frames/ball-a.svg" id="2_ob1rp"]
|
||||
[ext_resource type="Script" path="res://scripts/Contents/Bullets/Common/LockLauncher.gd" id="2_ropvu"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_83opd"]
|
||||
animations = [{
|
||||
@@ -25,7 +26,7 @@ tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 3, -0.25, 0, 0.25, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 10, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 1)
|
||||
}
|
||||
tracks/1/type = "bezier"
|
||||
@@ -36,7 +37,7 @@ tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 3, -0.25, 0, 0.25, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 10, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 1)
|
||||
}
|
||||
tracks/2/type = "bezier"
|
||||
@@ -47,7 +48,7 @@ tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 0.5, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.5, 1)
|
||||
}
|
||||
|
||||
@@ -93,7 +94,15 @@ _data = {
|
||||
"spawn": SubResource("Animation_hjoni")
|
||||
}
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_ts2ht"]
|
||||
radius = 35.0571
|
||||
|
||||
[node name="LaserPluse" instance=ExtResource("1_k5wxk")]
|
||||
z_index = -1
|
||||
script = ExtResource("2_ropvu")
|
||||
target = 1
|
||||
autoSpawnAnimation = true
|
||||
freeAfterSpawn = true
|
||||
|
||||
[node name="texture" parent="." index="0"]
|
||||
sprite_frames = SubResource("SpriteFrames_83opd")
|
||||
@@ -102,3 +111,6 @@ sprite_frames = SubResource("SpriteFrames_83opd")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_tbgxn")
|
||||
}
|
||||
|
||||
[node name="hitbox" parent="." index="1"]
|
||||
shape = SubResource("CircleShape2D_ts2ht")
|
||||
|
||||
@@ -12,4 +12,10 @@ func applyDot():
|
||||
await TickTool.millseconds(50)
|
||||
hitbox.disabled = false
|
||||
await TickTool.millseconds(50)
|
||||
BulletBase.generate(
|
||||
preload("res://components/Bullets/LaserPluse.tscn"),
|
||||
launcher,
|
||||
position,
|
||||
rotation
|
||||
)
|
||||
return true
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
extends BulletBase
|
||||
class_name LockLauncher
|
||||
|
||||
enum PositionType {
|
||||
SELF,
|
||||
TEXTURE,
|
||||
}
|
||||
|
||||
@export var target: PositionType = PositionType.SELF
|
||||
|
||||
func ai():
|
||||
if target == PositionType.SELF:
|
||||
position = launcher.position
|
||||
else:
|
||||
position = launcher.texture.global_position
|
||||
rotation = launcher.rotation
|
||||
@@ -11,8 +11,8 @@ var per: int = 0
|
||||
static var current: int = 0
|
||||
static var data: Array[Wave] = [
|
||||
# entity, minCount, maxCount, isBoss, from, to, per
|
||||
create(preload("res://components/Characters/Hen.tscn"), 1, 5, false, 8, INF, 1),
|
||||
create(preload("res://components/Characters/Chick.tscn"), 0, 0, true, 0, INF, 1)
|
||||
create(preload("res://components/Characters/Hen.tscn"), 1, 5, false, 0, INF, 1),
|
||||
create(preload("res://components/Characters/Chick.tscn"), 0, 0, true, 8, INF, 5)
|
||||
]
|
||||
|
||||
static func create(
|
||||
|
||||
@@ -13,6 +13,8 @@ class_name BulletBase
|
||||
@export var needEnergy: float = 0.0 # 发射时需要消耗的能量
|
||||
@export var autoSpawnAnimation: bool = false
|
||||
@export var autoLoopAnimation: bool = false
|
||||
@export var freeAfterSpawn: bool = false
|
||||
@export var knockback: float = 0 # 击退力,物理引擎单位
|
||||
|
||||
@onready var animator: AnimationPlayer = $"%animator"
|
||||
@onready var hitbox: CollisionShape2D = $"%hitbox"
|
||||
@@ -30,6 +32,8 @@ func _ready():
|
||||
if autoSpawnAnimation:
|
||||
animator.play("spawn")
|
||||
await animator.animation_finished
|
||||
if freeAfterSpawn:
|
||||
destroy()
|
||||
if autoLoopAnimation:
|
||||
animator.play("loop")
|
||||
dotLoop()
|
||||
|
||||
@@ -148,12 +148,13 @@ func takeDamage(bullet: BulletBase, crit: bool):
|
||||
var damage = baseDamage + baseDamage * int(crit) * fields.get(FieldStore.Entity.CRIT_DAMAGE)
|
||||
if sprinting:
|
||||
playSound("miss")
|
||||
storeEnergy(damage * 1.25)
|
||||
storeEnergy(damage * 0.5)
|
||||
damage = 0
|
||||
else:
|
||||
playSound("hurt")
|
||||
bullet.launcher.storeEnergy(damage * 0.05)
|
||||
storeEnergy(damage * -0.1)
|
||||
storeEnergy(damage * -0.25)
|
||||
position += Vector2.from_angle(bullet.position.angle_to_point(position)) * bullet.knockback
|
||||
hit.emit(damage, bullet, crit)
|
||||
healthChanged.emit(health)
|
||||
health -= damage
|
||||
@@ -162,7 +163,7 @@ func takeDamage(bullet: BulletBase, crit: bool):
|
||||
bullet.launcher.setBoss(self)
|
||||
if health <= 0:
|
||||
if isBoss:
|
||||
bullet.launcher.storeEnergy(energy)
|
||||
bullet.launcher.storeEnergy(energy * 0.5)
|
||||
bullet.launcher.setBoss(null)
|
||||
tryDie(bullet)
|
||||
func storeEnergy(value: float):
|
||||
|
||||
Reference in New Issue
Block a user