diff --git a/components/Bullets/RedCrystal.tscn b/components/Bullets/RedCrystal.tscn new file mode 100644 index 0000000..3a3e6e0 --- /dev/null +++ b/components/Bullets/RedCrystal.tscn @@ -0,0 +1,27 @@ +[gd_scene load_steps=5 format=3 uid="uid://c0oc8aqfef0tt"] + +[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_k4d80"] +[ext_resource type="Script" uid="uid://bv848wj2ko0y0" path="res://scripts/Contents/Bullets/RedCrystal.gd" id="2_llvlo"] +[ext_resource type="Texture2D" uid="uid://c7hyatbuieaj" path="res://resources/bullets/purple-crystal/frames/0.svg" id="3_hx3mn"] + +[sub_resource type="SpriteFrames" id="SpriteFrames_ns31y"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("3_hx3mn") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[node name="RedCrystal" instance=ExtResource("1_k4d80")] +script = ExtResource("2_llvlo") +displayName = "红水晶" +speed = 8.0 +lifeTime = 3000.0 +metadata/_edit_vertical_guides_ = [150.0] + +[node name="texture" parent="." index="0"] +modulate = Color(1.2892731, 0.44830602, 0.44830602, 1) +sprite_frames = SubResource("SpriteFrames_ns31y") diff --git a/components/Characters/Rooster.tscn b/components/Characters/Rooster.tscn index 382b26d..25515f1 100644 --- a/components/Characters/Rooster.tscn +++ b/components/Characters/Rooster.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=13 format=3 uid="uid://bm7ymrri6pykb"] +[gd_scene load_steps=14 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" uid="uid://cthtupc6dtbav" path="res://scripts/Contents/Characters/Rooster.gd" id="2_oqdqd"] +[ext_resource type="PackedScene" uid="uid://dt8w2w816tsj0" path="res://components/Weapons/RedCrystal.tscn" id="3_0omr3"] [ext_resource type="PackedScene" uid="uid://c0n3igy4hucrg" path="res://components/Weapons/PurpleCrystal.tscn" id="3_jluqw"] [ext_resource type="PackedScene" uid="uid://c3crr8r7y3oho" path="res://components/Weapons/BlueCrystal.tscn" id="4_0omr3"] [ext_resource type="AudioStream" uid="uid://cdrevrq7n6yqa" path="res://resources/sounds/effect/Boing.mp3" id="4_66s6c"] @@ -55,10 +56,14 @@ metadata/_edit_vertical_guides_ = [71.0] [node name="weaponStore" parent="." index="1"] process_mode = 4 -[node name="PurpleCrystal" parent="weaponStore" index="0" instance=ExtResource("3_jluqw")] +[node name="RedCrystal" parent="weaponStore" index="0" instance=ExtResource("3_0omr3")] +offset_bottom = 374.0 +debugRebuild = false + +[node name="PurpleCrystal" parent="weaponStore" index="1" instance=ExtResource("3_jluqw")] offset_bottom = 350.0 -[node name="BlueCrystal" parent="weaponStore" index="1" instance=ExtResource("4_0omr3")] +[node name="BlueCrystal" parent="weaponStore" index="2" instance=ExtResource("4_0omr3")] [node name="sprint" parent="sounds" index="0"] stream = ExtResource("4_66s6c") diff --git a/components/Effects/RedCrystalExplosion.tscn b/components/Effects/RedCrystalExplosion.tscn new file mode 100644 index 0000000..3f4f9b8 --- /dev/null +++ b/components/Effects/RedCrystalExplosion.tscn @@ -0,0 +1,57 @@ +[gd_scene load_steps=12 format=3 uid="uid://cbmleuw8a2mlg"] + +[ext_resource type="PackedScene" uid="uid://bcvuuy2m0pke0" path="res://components/Abstracts/EffectBase.tscn" id="1_cy5kq"] +[ext_resource type="AudioStream" uid="uid://dnv73q6g00vuo" path="res://resources/sounds/effect/crystal.mp3" id="2_elo1m"] + +[sub_resource type="Curve" id="Curve_cy5kq"] +_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.6, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 3 + +[sub_resource type="CurveTexture" id="CurveTexture_elo1m"] +curve = SubResource("Curve_cy5kq") + +[sub_resource type="Curve" id="Curve_n2oaw"] +_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_t885a"] +curve = SubResource("Curve_n2oaw") + +[sub_resource type="Gradient" id="Gradient_a655c"] +colors = PackedColorArray(1, 0.39999998, 0.39999998, 1, 0.6, 0, 0, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_thnw7"] +gradient = SubResource("Gradient_a655c") + +[sub_resource type="Curve" id="Curve_bapde"] +_data = [Vector2(0.6, 0.5), 0.0, 1.2500001, 0, 0, Vector2(1, 1), 1.2500001, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_0c4j8"] +curve = SubResource("Curve_bapde") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_w17p2"] +particle_flag_disable_z = true +angle_min = 1.0728835e-05 +angle_max = 360.00003 +angle_curve = SubResource("CurveTexture_t885a") +spread = 180.0 +initial_velocity_max = 500.0 +gravity = Vector3(0, 0, 0) +damping_min = 1000.00006 +damping_max = 1000.00006 +damping_curve = SubResource("CurveTexture_0c4j8") +scale_min = 3.0 +scale_max = 10.0 +color_initial_ramp = SubResource("GradientTexture1D_thnw7") +alpha_curve = SubResource("CurveTexture_elo1m") + +[node name="RedCrystalExplosion" instance=ExtResource("1_cy5kq")] +spawnSound = "spawn" + +[node name="spawn" parent="sounds" index="0"] +stream = ExtResource("2_elo1m") + +[node name="particles" parent="." index="1"] +amount = 100 +process_material = SubResource("ParticleProcessMaterial_w17p2") diff --git a/components/Feeds/A-CrystalBlock.tscn b/components/Feeds/A-CrystalBlock.tscn index 0bfb262..80d6bf0 100644 --- a/components/Feeds/A-CrystalBlock.tscn +++ b/components/Feeds/A-CrystalBlock.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=5 format=3 uid="uid://hutbnesqb8ql"] +[gd_scene load_steps=6 format=3 uid="uid://hutbnesqb8ql"] [ext_resource type="PackedScene" uid="uid://bykwevnv7keeh" path="res://components/Abstracts/FeedCardBase.tscn" id="1_b0uqe"] [ext_resource type="Texture2D" uid="uid://dwmw3is7s486j" path="res://resources/feeds/crystal-block.png" id="2_8e2d0"] [ext_resource type="PackedScene" uid="uid://c0n3igy4hucrg" path="res://components/Weapons/PurpleCrystal.tscn" id="3_2mapt"] [ext_resource type="PackedScene" uid="uid://c3crr8r7y3oho" path="res://components/Weapons/BlueCrystal.tscn" id="3_8e2d0"] +[ext_resource type="PackedScene" uid="uid://dt8w2w816tsj0" path="res://components/Weapons/RedCrystal.tscn" id="5_43qg2"] [node name="BlueCrystal" instance=ExtResource("1_b0uqe")] avatarTexture = ExtResource("2_8e2d0") @@ -12,7 +13,7 @@ quality = 2 topic = 8 fields = Array[int]([8]) fieldValues = Array[float]([0.1]) -weapons = Array[PackedScene]([ExtResource("3_2mapt"), ExtResource("3_8e2d0")]) +weapons = Array[PackedScene]([ExtResource("3_8e2d0"), ExtResource("3_2mapt"), ExtResource("5_43qg2")]) costs = Array[int]([0, 1]) costCounts = Array[int]([2000, 3000]) diff --git a/components/Feeds/A-RedCrystal.tscn b/components/Feeds/A-RedCrystal.tscn new file mode 100644 index 0000000..22bb554 --- /dev/null +++ b/components/Feeds/A-RedCrystal.tscn @@ -0,0 +1,24 @@ +[gd_scene load_steps=4 format=3 uid="uid://bqlig553oovpn"] + +[ext_resource type="PackedScene" uid="uid://bykwevnv7keeh" path="res://components/Abstracts/FeedCardBase.tscn" id="1_66pmg"] +[ext_resource type="Texture2D" uid="uid://s8r37cmth6o8" path="res://resources/weapons/red-crystal.png" id="2_0kdox"] +[ext_resource type="PackedScene" uid="uid://dt8w2w816tsj0" path="res://components/Weapons/RedCrystal.tscn" id="3_aumml"] + +[node name="RedCrystal" instance=ExtResource("1_66pmg")] +avatarTexture = ExtResource("2_0kdox") +displayName = "红水晶簇" +quality = 2 +topic = 8 +fields = Array[int]([9]) +fieldValues = Array[float]([-1.0]) +weapons = Array[PackedScene]([ExtResource("3_aumml")]) +costs = Array[int]([0, 1]) +costCounts = Array[int]([100, 150]) + +[node name="avatar" parent="container/info" index="0"] +texture = ExtResource("2_0kdox") + +[node name="name" parent="container/info" index="1"] +displayName = "红水晶簇" +quality = 2 +topic = 8 diff --git a/components/Weapons/BlueCrystal.tscn b/components/Weapons/BlueCrystal.tscn index a32d076..a98cdfc 100644 --- a/components/Weapons/BlueCrystal.tscn +++ b/components/Weapons/BlueCrystal.tscn @@ -9,9 +9,9 @@ script = ExtResource("2_jbcf8") avatarTexture = ExtResource("3_fewtg") displayName = "蓝水晶簇" -quality = 2 +typeTopic = 3 store = { -"atk": 5, +"atk": 3, "count": 2.0 } storeType = { @@ -30,7 +30,7 @@ texture = ExtResource("3_fewtg") [node name="name" parent="container/info" index="2"] displayName = "蓝水晶簇" -quality = 2 +typeTopic = 3 [node name="description" parent="container" index="2"] -text = "[center]发射[b]蓝水晶[/b],可无限追踪,命中造成[color=cyan]2[/color]点伤害,飞行过程中有[color=cyan]2[/color]颗[b]钻石[/b]环绕。[/center]" +text = "[center]发射[b]蓝水晶[/b],可无限追踪,命中造成[color=cyan]5[/color]点伤害,飞行过程中有[color=cyan]2[/color]颗[b]钻石[/b]环绕。[/center]" diff --git a/components/Weapons/PurpleCrystal.tscn b/components/Weapons/PurpleCrystal.tscn index fa9bc24..51856c0 100644 --- a/components/Weapons/PurpleCrystal.tscn +++ b/components/Weapons/PurpleCrystal.tscn @@ -11,8 +11,9 @@ script = ExtResource("2_0xgcv") avatarTexture = ExtResource("2_wgtcw") displayName = "紫水晶簇" costBeachball = 200 -descriptionTemplate = "撞击造成$atk点伤害。" +descriptionTemplate = "发射[b]紫水晶[/b],撞击时造成$atk点伤害。" cooldown = 200.0 +debugRebuild = true [node name="attack" parent="sounds" index="0"] stream = ExtResource("4_16daa") @@ -21,10 +22,10 @@ stream = ExtResource("4_16daa") texture = ExtResource("2_wgtcw") [node name="beachball" parent="container/info/infos" index="1"] -count = 250 +count = 200 [node name="name" parent="container/info" index="2"] displayName = "紫水晶簇" [node name="description" parent="container" index="2"] -text = "[center]撞击造成[color=cyan]10[/color]点伤害。[/center]" +text = "[center]发射[b]紫水晶[/b],撞击时造成[color=cyan]10[/color]点伤害。[/center]" diff --git a/components/Weapons/RedCrystal.tscn b/components/Weapons/RedCrystal.tscn new file mode 100644 index 0000000..b6c24da --- /dev/null +++ b/components/Weapons/RedCrystal.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=5 format=3 uid="uid://dt8w2w816tsj0"] + +[ext_resource type="PackedScene" uid="uid://ckq2cq6m23hq3" path="res://components/Abstracts/WeaponCardBase.tscn" id="1_88g2h"] +[ext_resource type="Texture2D" uid="uid://s8r37cmth6o8" path="res://resources/weapons/red-crystal.png" id="2_3e8g7"] +[ext_resource type="Script" uid="uid://dmsjasfucknxq" path="res://scripts/Contents/Weapons/RedCrystal.gd" id="2_wfewu"] +[ext_resource type="AudioStream" uid="uid://dclinyhu256xi" path="res://resources/sounds/effect/Low Whoosh.mp3" id="4_qt0vq"] + +[node name="RedCrystal" instance=ExtResource("1_88g2h")] +script = ExtResource("2_wfewu") +avatarTexture = ExtResource("2_3e8g7") +displayName = "红水晶簇" +typeTopic = 1 +store = { +"atk": 40, +"radius": 150.0 +} +storeType = { +"atk": 1, +"radius": 1 +} +descriptionTemplate = "发射[b]红水晶[/b],在3秒后以$radius的半径爆炸,造成$atk点伤害。" +cooldown = 2000.0 +debugRebuild = true + +[node name="attack" parent="sounds" index="0"] +stream = ExtResource("4_qt0vq") + +[node name="avatar" parent="container/info" index="0"] +texture = ExtResource("2_3e8g7") + +[node name="name" parent="container/info" index="2"] +displayName = "红水晶簇" +typeTopic = 1 + +[node name="description" parent="container" index="2"] +text = "[center]发射[b]红水晶[/b],在3秒后以[color=cyan]150[/color]的半径爆炸,造成[color=cyan]40[/color]点伤害。[/center]" diff --git a/project.godot b/project.godot index eebf13a..5c32577 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="ChickenVSBear" -run/main_scene="res://components/Scenes/World.tscn" +run/main_scene="uid://dmxi1ikn6avig" config/features=PackedStringArray("4.5", "GL Compatibility") config/icon="res://icon.svg" diff --git a/resources/sounds/effect/crystal.mp3 b/resources/sounds/effect/crystal.mp3 new file mode 100644 index 0000000..7b0f0f1 Binary files /dev/null and b/resources/sounds/effect/crystal.mp3 differ diff --git a/resources/sounds/effect/crystal.mp3.import b/resources/sounds/effect/crystal.mp3.import new file mode 100644 index 0000000..1b1e797 --- /dev/null +++ b/resources/sounds/effect/crystal.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://dnv73q6g00vuo" +path="res://.godot/imported/crystal.mp3-16c4912a4753d8f726349a830585555a.mp3str" + +[deps] + +source_file="res://resources/sounds/effect/crystal.mp3" +dest_files=["res://.godot/imported/crystal.mp3-16c4912a4753d8f726349a830585555a.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/resources/weapons/red-crystal.png b/resources/weapons/red-crystal.png new file mode 100644 index 0000000..8a67b8a Binary files /dev/null and b/resources/weapons/red-crystal.png differ diff --git a/resources/weapons/red-crystal.png.import b/resources/weapons/red-crystal.png.import new file mode 100644 index 0000000..49e3b2f --- /dev/null +++ b/resources/weapons/red-crystal.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://s8r37cmth6o8" +path="res://.godot/imported/red-crystal.png-67abc7ab55282ddcb27f35f1d1767715.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resources/weapons/red-crystal.png" +dest_files=["res://.godot/imported/red-crystal.png-67abc7ab55282ddcb27f35f1d1767715.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 diff --git a/scripts/Contents/Bullets/RedCrystal.gd b/scripts/Contents/Bullets/RedCrystal.gd new file mode 100644 index 0000000..8c693bc --- /dev/null +++ b/scripts/Contents/Bullets/RedCrystal.gd @@ -0,0 +1,14 @@ +extends BulletBase +class_name RedCrystalBullet + +var radius: float = 0 + +func register(): + hitbox.shape = hitbox.shape.duplicate() +func ai(): + PresetBulletAI.forward(self, rotation) + speed = (1 - lifeTimePercent()) * initialSpeed +func destroy(_beacuseMap: bool): + hitbox.shape.radius = radius + EffectController.create(ComponentManager.getEffect("RedCrystalExplosion"), global_position).shot() + await TickTool.millseconds(100) diff --git a/scripts/Contents/Bullets/RedCrystal.gd.uid b/scripts/Contents/Bullets/RedCrystal.gd.uid new file mode 100644 index 0000000..8237938 --- /dev/null +++ b/scripts/Contents/Bullets/RedCrystal.gd.uid @@ -0,0 +1 @@ +uid://bv848wj2ko0y0 diff --git a/scripts/Contents/Weapons/RedCrystal.gd b/scripts/Contents/Weapons/RedCrystal.gd new file mode 100644 index 0000000..cfee540 --- /dev/null +++ b/scripts/Contents/Weapons/RedCrystal.gd @@ -0,0 +1,15 @@ +@tool +extends Weapon +class_name RedCrystalWeapon + +func update(to: int, origin: Dictionary, _entity: EntityBase): + origin["atk"] += 2 * to * soulLevel + origin["radius"] += 4 * to * soulLevel + return origin +func attack(entity: EntityBase): + var weaponPos = entity.findWeaponAnchor("normal") + for bullet in BulletBase.generate(ComponentManager.getBullet("RedCrystal"), entity, weaponPos, (get_global_mouse_position() - weaponPos).angle()): + if bullet is RedCrystalBullet: + bullet.baseDamage = readStore("atk") + bullet.radius = readStore("radius") + return true diff --git a/scripts/Contents/Weapons/RedCrystal.gd.uid b/scripts/Contents/Weapons/RedCrystal.gd.uid new file mode 100644 index 0000000..9c5ebe6 --- /dev/null +++ b/scripts/Contents/Weapons/RedCrystal.gd.uid @@ -0,0 +1 @@ +uid://dmsjasfucknxq diff --git a/scripts/Statemachine/BulletBase.gd b/scripts/Statemachine/BulletBase.gd index 9cdb73f..a65c5d9 100644 --- a/scripts/Statemachine/BulletBase.gd +++ b/scripts/Statemachine/BulletBase.gd @@ -36,6 +36,7 @@ var initialSpeed: float = 0 var initialDamage: float = 0 var speedScale: float = 1 var parentScene: PackedScene = null +var isFirstFrame: bool = true func _ready(): initialSpeed = speed @@ -85,6 +86,9 @@ func _physics_process(_delta: float) -> void: targetEntity.getTrackingAnchor(), launcher.fields.get(FieldStore.Entity.BULLET_TRACE) / 10 ) + if isFirstFrame: + firstFrame() + isFirstFrame = false ai() else: tryDestroy() @@ -122,6 +126,8 @@ func timeLived(): return WorldManager.getTime() - spawnInWhen func distanceLived(): return position.distance_to(spawnInWhere) +func lifeTimePercent(): + return timeLived() / lifeTime func lifeDistancePercent(): return distanceLived() / lifeDistance func dotLoop(): @@ -156,6 +162,8 @@ func tryRefract(): refract(entity, i, total, last) # 抽象方法 +func firstFrame(): + pass func ai(): pass func destroy(_beacuseMap: bool): diff --git a/scripts/Statemachine/EffectController.gd b/scripts/Statemachine/EffectController.gd index 3158a2c..f00c9ad 100644 --- a/scripts/Statemachine/EffectController.gd +++ b/scripts/Statemachine/EffectController.gd @@ -24,6 +24,10 @@ func shot(): if oneShot: await cloned.finished cloned.queue_free() + if spawnSound: + var sound: AudioStreamPlayer2D = sounds.get_node(spawnSound) + if sound.playing: + await sound.finished queue_free() static func create(scene: PackedScene, spawnPosition: Vector2, parent: Node2D = null) -> EffectController: