mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
feat(武器): 添加齿轮回旋镖武器及其子弹效果
添加新的武器"齿轮回旋镖"及其配套子弹资源: 1. 实现齿轮武器的基本逻辑,包括攻击和属性计算 2. 添加齿轮子弹的旋转、减速和回旋行为 3. 包含相关资源文件(图片、场景、脚本) 4. 将新武器添加到公鸡角色的武器库中
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://cdv7drkq43mfe"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_mt0uq"]
|
||||
[ext_resource type="Script" uid="uid://cfe4nv832olhp" path="res://scripts/Contents/Bullets/Cogwheel.gd" id="2_cjmf3"]
|
||||
[ext_resource type="Texture2D" uid="uid://d0d1t8ch1lolp" path="res://resources/bullets/cogwheel/cogwheel.png" id="2_jis23"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_cjmf3"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("2_jis23")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_cjmf3"]
|
||||
radius = 47.0
|
||||
|
||||
[sub_resource type="Curve" id="Curve_cjmf3"]
|
||||
_data = [Vector2(0, 0.6), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_d8ajx"]
|
||||
curve = SubResource("Curve_cjmf3")
|
||||
|
||||
[sub_resource type="Curve" id="Curve_gidgr"]
|
||||
_data = [Vector2(0, 1), 0.0, -0.35000002, 0, 1, Vector2(1, 0.65), -0.35000002, 0.0, 1, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_qlov4"]
|
||||
curve = SubResource("Curve_gidgr")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_d26hc"]
|
||||
particle_flag_disable_z = true
|
||||
direction = Vector3(-1, 0, 0)
|
||||
spread = 0.0
|
||||
initial_velocity_min = 700.0
|
||||
initial_velocity_max = 700.0
|
||||
gravity = Vector3(0, 0, 0)
|
||||
scale_min = 0.9
|
||||
scale_max = 0.9
|
||||
scale_curve = SubResource("CurveTexture_qlov4")
|
||||
alpha_curve = SubResource("CurveTexture_d8ajx")
|
||||
|
||||
[node name="Cogwheel" instance=ExtResource("1_mt0uq")]
|
||||
script = ExtResource("2_cjmf3")
|
||||
displayName = "齿轮"
|
||||
speed = 20.0
|
||||
baseDamage = null
|
||||
damageMultipliers = null
|
||||
usingDamageMultiplier = null
|
||||
penerate = 1.0
|
||||
penerateDamageReduction = null
|
||||
lifeDistance = null
|
||||
lifeTime = 5000.0
|
||||
allowFriendlyDamage = null
|
||||
canDamageSelf = null
|
||||
autoSpawnAnimation = null
|
||||
autoLoopAnimation = null
|
||||
autoDestroyAnimation = null
|
||||
autoDestroyOnHitMap = null
|
||||
freeAfterSpawn = null
|
||||
knockback = null
|
||||
recoil = null
|
||||
canDoDuplicate = null
|
||||
|
||||
[node name="texture" parent="." index="0"]
|
||||
scale = Vector2(0.2, 0.2)
|
||||
sprite_frames = SubResource("SpriteFrames_cjmf3")
|
||||
|
||||
[node name="hitbox" parent="." index="1"]
|
||||
visible = false
|
||||
shape = SubResource("CircleShape2D_cjmf3")
|
||||
|
||||
[node name="trails" type="GPUParticles2D" parent="." index="2"]
|
||||
z_index = -1
|
||||
scale = Vector2(0.2, 0.2)
|
||||
amount = 5
|
||||
texture = ExtResource("2_jis23")
|
||||
preprocess = 1.0
|
||||
local_coords = true
|
||||
process_material = SubResource("ParticleProcessMaterial_d26hc")
|
||||
@@ -1,7 +1,9 @@
|
||||
[gd_scene load_steps=19 format=3 uid="uid://dky8574uqc18r"]
|
||||
[gd_scene load_steps=21 format=3 uid="uid://dky8574uqc18r"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_e5pl8"]
|
||||
[ext_resource type="Script" uid="uid://cthtupc6dtbav" path="res://scripts/Contents/Characters/Rooster.gd" id="2_oqdqd"]
|
||||
[ext_resource type="PackedScene" uid="uid://dqywctcj4y2xi" path="res://components/Weapons/Cogwheel.tscn" id="3_da2ca"]
|
||||
[ext_resource type="PackedScene" uid="uid://c0n3igy4hucrg" path="res://components/Weapons/PurpleCrystal.tscn" id="4_0omr3"]
|
||||
[ext_resource type="AudioStream" uid="uid://cdrevrq7n6yqa" path="res://resources/sounds/effect/Boing.mp3" id="4_66s6c"]
|
||||
[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"]
|
||||
@@ -110,6 +112,10 @@ process_material = SubResource("ParticleProcessMaterial_joj4g")
|
||||
[node name="weaponStore" parent="." index="2"]
|
||||
process_mode = 4
|
||||
|
||||
[node name="Cogwheel" parent="weaponStore" index="0" instance=ExtResource("3_da2ca")]
|
||||
|
||||
[node name="PurpleCrystal" parent="weaponStore" index="1" instance=ExtResource("4_0omr3")]
|
||||
|
||||
[node name="sprint" parent="sounds" index="0"]
|
||||
stream = ExtResource("4_66s6c")
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dqywctcj4y2xi"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ckq2cq6m23hq3" path="res://components/Abstracts/WeaponCardBase.tscn" id="1_ga2jk"]
|
||||
[ext_resource type="Script" uid="uid://nm2xleunwf4r" path="res://scripts/Contents/Weapons/Cogwheel.gd" id="2_c1bcd"]
|
||||
[ext_resource type="Texture2D" uid="uid://d0d1t8ch1lolp" path="res://resources/bullets/cogwheel/cogwheel.png" id="2_qs30c"]
|
||||
|
||||
[node name="Cogwheel" instance=ExtResource("1_ga2jk")]
|
||||
script = ExtResource("2_c1bcd")
|
||||
avatarTexture = ExtResource("2_qs30c")
|
||||
displayName = "齿轮回旋镖"
|
||||
quality = 3
|
||||
store = {
|
||||
"atk": 5,
|
||||
"rotate": 15.0
|
||||
}
|
||||
storeType = {
|
||||
"atk": 1,
|
||||
"rotate": 3
|
||||
}
|
||||
descriptionTemplate = "发射[b]齿轮[/b],在飞行一定距离后回旋。
|
||||
齿轮的伤害频率与转速成正比。
|
||||
锋利度:$atk,初始转速:$rotate,
|
||||
齿轮的转速随时间逐渐降低。"
|
||||
cooldown = 1000.0
|
||||
debugRebuild = true
|
||||
|
||||
[node name="avatar" parent="container/info" index="0"]
|
||||
texture = ExtResource("2_qs30c")
|
||||
|
||||
[node name="name" parent="container/info" index="2"]
|
||||
displayName = "齿轮回旋镖"
|
||||
quality = 3
|
||||
|
||||
[node name="description" parent="container" index="2"]
|
||||
text = "[center]发射[b]齿轮[/b],在飞行一定距离后回旋。
|
||||
齿轮的伤害频率与转速成正比。
|
||||
锋利度:[color=cyan]5[/color],初始转速:[color=cyan]15.0°[/color],
|
||||
齿轮的转速随时间逐渐降低。[/center]"
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 328 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d0d1t8ch1lolp"
|
||||
path="res://.godot/imported/cogwheel.png-0cef3468595cc625d2a11b670aa34414.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://resources/bullets/cogwheel/cogwheel.png"
|
||||
dest_files=["res://.godot/imported/cogwheel.png-0cef3468595cc625d2a11b670aa34414.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -0,0 +1,32 @@
|
||||
extends BulletBase
|
||||
class_name CogwheelBullet
|
||||
|
||||
var initialRotate: float = 0
|
||||
var rotateSpeed: float = 0
|
||||
var dotTime: float = 0
|
||||
var slow: float = 0.2
|
||||
|
||||
func ai():
|
||||
PresetBulletAI.forward(self, rotation)
|
||||
texture.rotation_degrees += rotateSpeed
|
||||
if rotateSpeed < 0:
|
||||
speed += slow
|
||||
PresetBulletAI.trace(self, launcher.position, 0.1)
|
||||
if position.distance_to(launcher.position) < 100:
|
||||
tryDestroy()
|
||||
else:
|
||||
speed = initialSpeed * (rotateSpeed / initialRotate)
|
||||
dotTime = 1000 / (rotateSpeed)
|
||||
rotateSpeed -= slow
|
||||
func applyDot():
|
||||
hitbox.disabled = true
|
||||
await TickTool.frame()
|
||||
hitbox.disabled = false
|
||||
await TickTool.millseconds(dotTime / launcher.fields[FieldStore.Entity.ATTACK_SPEED])
|
||||
await TickTool.frame() # 等至少一帧,防止跳帧导致没检测到伤害
|
||||
return true
|
||||
|
||||
func refract(newBullet: BulletBase, _entity: EntityBase, _index: int, _total: int, _lastBullet: float):
|
||||
if newBullet is CogwheelBullet:
|
||||
newBullet.rotateSpeed = initialRotate
|
||||
return newBullet
|
||||
@@ -0,0 +1 @@
|
||||
uid://cfe4nv832olhp
|
||||
@@ -0,0 +1,20 @@
|
||||
@tool
|
||||
extends Weapon
|
||||
|
||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["atk"] += 2 * to * soulLevel
|
||||
origin["rotate"] += 1 * to * soulLevel
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var weaponPos = entity.findWeaponAnchor("normal")
|
||||
for bullet in BulletBase.generate(
|
||||
ComponentManager.getBullet("Cogwheel"),
|
||||
entity,
|
||||
weaponPos,
|
||||
weaponPos.angle_to_point(get_global_mouse_position()),
|
||||
):
|
||||
if bullet is CogwheelBullet:
|
||||
bullet.initialRotate = readStore("rotate")
|
||||
bullet.rotateSpeed = readStore("rotate")
|
||||
bullet.baseDamage = readStore("atk")
|
||||
return true
|
||||
@@ -0,0 +1 @@
|
||||
uid://nm2xleunwf4r
|
||||
Reference in New Issue
Block a user