1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-27 22:41:56 +08:00

feat(子弹): 添加BlockWall子弹类型并实现击退效果

为CyberCat角色添加新的攻击类型3,发射BlockWall子弹
修改子弹资源为长条形并调整碰撞形状
实现子弹命中后的击退效果
This commit is contained in:
2026-04-05 21:09:47 +08:00
parent 1a78d5b82b
commit 1910f10e9a
6 changed files with 153 additions and 4 deletions
+137 -1
View File
@@ -1,6 +1,7 @@
[gd_scene format=3 uid="uid://cch4xtc70ad5c"]
[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_3kq6o"]
[ext_resource type="Script" uid="uid://b6bkhv8nc1ao3" path="res://scripts/Contents/Bullets/BlockWall.gd" id="2_3x2nv"]
[ext_resource type="Texture2D" uid="uid://cqcakyrw4vbfn" path="res://resources/bullets/blockwall/blockwall.svg" id="2_k65pw"]
[sub_resource type="SpriteFrames" id="SpriteFrames_3x2nv"]
@@ -14,7 +15,142 @@ animations = [{
"speed": 5.0
}]
[node name="BulletBase" unique_id=5571707 instance=ExtResource("1_3kq6o")]
[sub_resource type="Animation" id="Animation_k65pw"]
length = 0.001
tracks/0/type = "bezier"
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 = {
"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(".:position:x")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0, -0.15, 0, 0.15, 0),
"times": PackedFloat32Array(0)
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_3x2nv"]
resource_name = "spawn"
length = 0.2
step = 0.1
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position:x")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(0, 0, 0, 0.2, 0, -100, 0, 0, 0, 0),
"times": PackedFloat32Array(0, 0.2)
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.2),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
[sub_resource type="Animation" id="Animation_cdtmv"]
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_a0fqf"]
resource_name = "spawn"
length = 0.2
step = 0.1
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position:x")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(2, 0),
"points": PackedFloat32Array(-100, 0, 0, 0, 0, 0, -0.2, 0, 0, 0),
"times": PackedFloat32Array(0, 0.2)
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.2),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_y5axk"]
_data = {
&"RESET": SubResource("Animation_k65pw"),
&"destroy": SubResource("Animation_3x2nv"),
&"loop": SubResource("Animation_cdtmv"),
&"spawn": SubResource("Animation_a0fqf")
}
[sub_resource type="RectangleShape2D" id="RectangleShape2D_k65pw"]
size = Vector2(734, 56)
[node name="BlockWall" unique_id=5571707 instance=ExtResource("1_3kq6o")]
script = ExtResource("2_3x2nv")
speed = -10.0
baseDamage = 0.0
penerate = 1.0
lifeTime = 1000.0
autoSpawnAnimation = true
autoDestroyAnimation = true
[node name="texture" parent="." index="0" unique_id=162977358]
sprite_frames = SubResource("SpriteFrames_3x2nv")
[node name="animator" parent="texture" index="0" unique_id=1114087117]
libraries/ = SubResource("AnimationLibrary_y5axk")
[node name="hitbox" parent="." index="1" unique_id=175349408]
rotation = 1.5707964
shape = SubResource("RectangleShape2D_k65pw")
+1 -1
View File
@@ -1 +1 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="135.65107" height="135.65107" viewBox="0,0,135.65107,135.65107"><g transform="translate(-215.66196,-141.65862)"><g fill-opacity="0.50196" fill="#ff9b87" stroke="#ff9b86" stroke-width="3" stroke-miterlimit="10"><path d="M217.16197,275.80969v-132.65107h132.65107v132.65107z"/></g></g></svg><!--rotationCenter:24.33803499999999:38.34137999999999-->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="56.65107" height="734.65107" viewBox="0,0,56.65107,734.65107"><g transform="translate(-211.67446,187.32554)"><g fill-opacity="0.50196" fill="#ff9b87" stroke="#ff9b86" stroke-width="3" stroke-miterlimit="10"><path d="M213.17447,-185.82554l53.65107,0v731.65107l-53.65107,0z"/></g></g></svg><!--rotationCenter:28.32553500000003:367.3255350000002-->

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 449 B

+5
View File
@@ -0,0 +1,5 @@
extends BulletBase
class_name BlockWallBullet
func succeedToHit(_dmg: float, entity: EntityBase):
entity.impluse(Vector2.from_angle(rotation) * 1000)
@@ -0,0 +1 @@
uid://b6bkhv8nc1ao3
+7
View File
@@ -8,10 +8,12 @@ func register():
attackCooldownMap[0] = 6000
attackCooldownMap[1] = 10000
attackCooldownMap[2] = 100
attackCooldownMap[3] = 200
func ai():
PresetEntityAI.follow(self , currentFocusedBoss)
for i in 3:
tryAttack(i)
PresetEntityAI.distanceAttack(self , currentFocusedBoss, 1000, INF, 3)
func attack(type: int):
if type == 0:
BulletBase.generate(ComponentManager.getBullet("Bengbeng"), self , position, 0)
@@ -19,3 +21,8 @@ func attack(type: int):
heal(percentHealth(0.05))
elif type == 2:
BulletBase.generate(ComponentManager.getBullet("SCBlock"), self , position, 0)
elif type == 3:
for bullet in BulletBase.generate(ComponentManager.getBullet("BlockWall"), self , currentFocusedBoss.hurtbox.global_position, 0):
if bullet is BlockWallBullet:
bullet.look_at(position)
bullet.position -= Vector2.from_angle(bullet.rotation) * 100
+2 -2
View File
@@ -50,8 +50,8 @@ static var WAVE_TESTBOSS_CHICK = [
]
static var WAVE_JUSTJOKE = [
# Wave.create("Kernyr", 0, 0, true, 0, INF, 1),
# Wave.create("CyberCat", 0, 0, true, 0, INF, 1),
Wave.create("Deepsea", 0, 0, true, 0, INF, 1)
Wave.create("CyberCat", 0, 0, true, 0, INF, 1),
# Wave.create("Deepsea", 0, 0, true, 0, INF, 1)
]
static var WAVE_MOWING = [
Wave.create("Hen", 15, 30, false, 0, INF, 1),