From 95db9deb3cd12a06723892be0b5fbbb225f58e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Sat, 6 Sep 2025 13:27:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=9F=A2=E9=87=8F?= =?UTF-8?q?=E6=98=9F=E6=AD=A6=E5=99=A8=E5=92=8C=E5=AD=90=E5=BC=B9=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 实现新的矢量星武器系统,包括武器卡片、子弹行为和粒子效果。主要功能包括: - 添加VectorStarWeapon.gd武器脚本,支持多子弹发射和追踪目标 - 实现VectorStar.gd子弹脚本,包含初始冲刺和后续追踪逻辑 - 添加相关场景资源和配置 - 将新武器添加到公鸡角色的武器库中 --- components/Abstracts/FullscreenPanelBase.tscn | 2 +- components/Bullets/VectorStar.tscn | 15 ++++++--- components/Characters/Rooster.tscn | 6 +++- components/Weapons/VectorStar.tscn | 33 +++++++++++++++++++ project.godot | 5 +++ scripts/Contents/Bullets/VectorStar.gd | 18 ++++++++++ scripts/Contents/Weapons/VectorStarWeapon.gd | 19 +++++++++++ 7 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 components/Weapons/VectorStar.tscn create mode 100644 scripts/Contents/Bullets/VectorStar.gd create mode 100644 scripts/Contents/Weapons/VectorStarWeapon.gd diff --git a/components/Abstracts/FullscreenPanelBase.tscn b/components/Abstracts/FullscreenPanelBase.tscn index eb3f121..a00ffb6 100644 --- a/components/Abstracts/FullscreenPanelBase.tscn +++ b/components/Abstracts/FullscreenPanelBase.tscn @@ -53,7 +53,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, -500, -0.25, 0, 0.25, 0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 500, -0.25, 0, 0.25, 0), "times": PackedFloat32Array(0, 0.5) } diff --git a/components/Bullets/VectorStar.tscn b/components/Bullets/VectorStar.tscn index 6f2de6a..711f882 100644 --- a/components/Bullets/VectorStar.tscn +++ b/components/Bullets/VectorStar.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=9 format=3 uid="uid://ro1df12asa6y"] +[gd_scene load_steps=10 format=3 uid="uid://ro1df12asa6y"] [ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_fyvdf"] +[ext_resource type="Script" path="res://scripts/Contents/Bullets/VectorStar.gd" id="2_1u5ed"] [ext_resource type="Texture2D" uid="uid://d2pndtow16635" path="res://resources/bullets/lgbt-bullet/造型2.svg" id="2_7b7fr"] [sub_resource type="SpriteFrames" id="SpriteFrames_jj20o"] @@ -15,7 +16,7 @@ animations = [{ }] [sub_resource type="Curve" id="Curve_y5wc0"] -_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +_data = [Vector2(0, 0.5), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] point_count = 2 [sub_resource type="CurveTexture" id="CurveTexture_c22if"] @@ -32,17 +33,23 @@ curve = SubResource("Curve_r5tug") particle_flag_disable_z = true direction = Vector3(-1, 0, 0) spread = 0.0 -initial_velocity_min = 50.0 -initial_velocity_max = 100.0 +initial_velocity_min = 100.0 +initial_velocity_max = 200.0 gravity = Vector3(0, 0, 0) +scale_min = 0.5 +scale_max = 0.5 scale_curve = SubResource("CurveTexture_6bcs1") alpha_curve = SubResource("CurveTexture_c22if") [node name="VectorStar" instance=ExtResource("1_fyvdf")] +script = ExtResource("2_1u5ed") +lifeDistance = 3000.0 [node name="texture" parent="." index="0"] +rotation = 0.0174533 sprite_frames = SubResource("SpriteFrames_jj20o") [node name="particles" type="GPUParticles2D" parent="." index="2"] +amount = 20 process_material = SubResource("ParticleProcessMaterial_bieyj") texture = ExtResource("2_7b7fr") diff --git a/components/Characters/Rooster.tscn b/components/Characters/Rooster.tscn index 53594d5..833031e 100644 --- a/components/Characters/Rooster.tscn +++ b/components/Characters/Rooster.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=3 uid="uid://bm7ymrri6pykb"] +[gd_scene load_steps=17 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"] @@ -11,6 +11,7 @@ [ext_resource type="PackedScene" uid="uid://wl8u5m52708w" path="res://components/Weapons/LGBT.tscn" id="4_pb8qn"] [ext_resource type="PackedScene" uid="uid://cxabqjo7skxev" path="res://components/Weapons/BigLaser.tscn" id="4_plqwu"] [ext_resource type="AudioStream" uid="uid://dmxh3bpk8vyy5" path="res://resources/sounds/effect/Coin.mp3" id="5_xnbhq"] +[ext_resource type="PackedScene" uid="uid://bb1uh8k7gkhr7" path="res://components/Weapons/VectorStar.tscn" id="6_fvy5n"] [ext_resource type="AudioStream" uid="uid://4wuuf1osk0yv" path="res://resources/sounds/effect/Low Boing.wav" id="6_m5px1"] [ext_resource type="AudioStream" uid="uid://b10u6iir6uvqn" path="res://resources/sounds/effect/BigLaser.wav" id="8_7dhim"] @@ -51,6 +52,9 @@ process_mode = 4 [node name="BigLaser" parent="weaponStore" index="2" instance=ExtResource("4_plqwu")] +[node name="VectorStar" parent="weaponStore" index="3" instance=ExtResource("6_fvy5n")] +debugRebuild = false + [node name="sprint" parent="sounds" index="0"] stream = ExtResource("4_66s6c") diff --git a/components/Weapons/VectorStar.tscn b/components/Weapons/VectorStar.tscn new file mode 100644 index 0000000..bd4f9de --- /dev/null +++ b/components/Weapons/VectorStar.tscn @@ -0,0 +1,33 @@ +[gd_scene load_steps=4 format=3 uid="uid://bb1uh8k7gkhr7"] + +[ext_resource type="PackedScene" uid="uid://ckq2cq6m23hq3" path="res://components/Abstracts/WeaponCardBase.tscn" id="1_tmgup"] +[ext_resource type="Script" path="res://scripts/Contents/Weapons/VectorStarWeapon.gd" id="2_1dfg4"] +[ext_resource type="Texture2D" uid="uid://d2pndtow16635" path="res://resources/bullets/lgbt-bullet/造型2.svg" id="3_wfty8"] + +[node name="VectorStar" instance=ExtResource("1_tmgup")] +script = ExtResource("2_1dfg4") +avatarTexture = ExtResource("3_wfty8") +displayName = "星辰核心" +quality = 2 +store = { +"atk": 5, +"forwardtime": 1, +"maxcount": 6, +"mincount": 3 +} +storeType = Array[int]([0, 0, 0, 0]) +descriptionTemplate = "发射$mincount~$maxcount个[b]无主的矢量星[/b],在$forwardtime秒后向目标冲刺并造成$atk点伤害。" +needEnergy = 20.0 + +[node name="avatar" parent="container/info" index="0"] +texture = ExtResource("3_wfty8") + +[node name="energy" parent="container/info/infos/energyInfo" index="1"] +text = "20.0" + +[node name="name" parent="container/info" index="2"] +displayName = "星辰核心" +quality = 2 + +[node name="description" parent="container" index="2"] +text = "[center]发射[color=cyan]3.0[/color]~[color=cyan]6.0[/color]个[b]无主的矢量星[/b],在[color=cyan]1.0[/color]秒后向目标冲刺并造成[color=cyan]5.0[/color]点伤害。[/center]" diff --git a/project.godot b/project.godot index 04baa8e..b551fef 100644 --- a/project.godot +++ b/project.godot @@ -15,6 +15,11 @@ run/main_scene="res://components/Scenes/World.tscn" config/features=PackedStringArray("4.3", "GL Compatibility") config/icon="res://icon.svg" +[display] + +window/size/viewport_width=1280 +window/size/viewport_height=720 + [dotnet] project/assembly_name="ChickenVSBear" diff --git a/scripts/Contents/Bullets/VectorStar.gd b/scripts/Contents/Bullets/VectorStar.gd new file mode 100644 index 0000000..68d1c49 --- /dev/null +++ b/scripts/Contents/Bullets/VectorStar.gd @@ -0,0 +1,18 @@ +extends BulletBase +class_name VectorStar + +var tracer: EntityBase = null +var forwardTime: float = 1000 +var forwarded: bool = false + +func ai(): + texture.rotation_degrees *= 1.1 + PresetAIs.forward(self, rotation) + if timeLived() <= forwardTime: + speed = 10 * ((forwardTime - timeLived()) / forwardTime) + elif forwarded: + speed = (timeLived() - forwardTime) / 20 + else: + forwarded = true + if is_instance_valid(tracer): + rotation = position.angle_to_point(tracer.position) diff --git a/scripts/Contents/Weapons/VectorStarWeapon.gd b/scripts/Contents/Weapons/VectorStarWeapon.gd new file mode 100644 index 0000000..be0434b --- /dev/null +++ b/scripts/Contents/Weapons/VectorStarWeapon.gd @@ -0,0 +1,19 @@ +@tool +extends Weapon +class_name VectorStarWeapon + +func update(to: int, origin: Dictionary, _entity: EntityBase): + origin["atk"] += 2 * to + origin["forwardtime"] /= 1.05 * to + origin["mincount"] += 1 * level + origin["maxcount"] += 1 * level + return origin +func attack(entity: EntityBase): + var weaponPos = entity.findWeaponAnchor("normal") + for i in range(int(randi_range(readStore("mincount"), readStore("maxcount")))): + for j in BulletBase.generate(preload("res://components/Bullets/VectorStar.tscn"), entity, weaponPos, deg_to_rad(randf_range(0, 360))): + var bullet: VectorStar = j + bullet.damage = readStore("atk") + bullet.tracer = EntityTool.findClosetEntity(get_global_mouse_position(), get_tree(), !entity.isPlayer(), entity.isPlayer()) + bullet.forwardTime = readStore("forwardtime") * 1000 + return true