diff --git a/components/Bullets/Volcano.tscn b/components/Bullets/Volcano.tscn index 4df3685..270c3db 100644 --- a/components/Bullets/Volcano.tscn +++ b/components/Bullets/Volcano.tscn @@ -183,8 +183,8 @@ _data = { &"spawn": SubResource("Animation_o5h0y") } -[sub_resource type="CircleShape2D" id="CircleShape2D_1sgli"] -radius = 78.05767 +[sub_resource type="RectangleShape2D" id="RectangleShape2D_1sgli"] +size = Vector2(23.999994, 124) [node name="Volcano" unique_id=2046549391 instance=ExtResource("1_gd3m7")] script = ExtResource("2_w1utg") @@ -212,7 +212,7 @@ texture = ExtResource("2_wwxm2") [node name="hitbox" parent="." index="1" unique_id=175349408 node_paths=PackedStringArray("target")] position = Vector2(299.99997, 0.1221919) rotation = 0.00040731629 -shape = SubResource("CircleShape2D_1sgli") +shape = SubResource("RectangleShape2D_1sgli") script = ExtResource("7_1sgli") target = NodePath("../texture/anchor/textureSword") offsetRotation = 45.0 diff --git a/components/Characters/MuyangDog.tscn b/components/Characters/MuyangDog.tscn index 2fd2b05..29b60f1 100644 --- a/components/Characters/MuyangDog.tscn +++ b/components/Characters/MuyangDog.tscn @@ -2,14 +2,10 @@ [ext_resource type="PackedScene" uid="uid://bs863g2s8r770" path="res://components/Abstracts/PlayerBase.tscn" id="1_y3l4w"] [ext_resource type="Script" uid="uid://bbmb572iba42l" path="res://scripts/Contents/Characters/MuyangDog.gd" id="2_mr6nm"] -[ext_resource type="PackedScene" uid="uid://dqywctcj4y2xi" path="res://components/Weapons/Cogwheel.tscn" id="3_im5m5"] -[ext_resource type="PackedScene" uid="uid://cx7nogfnv7s8t" path="res://components/Weapons/Tree.tscn" id="4_im5m5"] +[ext_resource type="PackedScene" uid="uid://u0djqwuuysp8" path="res://components/Weapons/Volcano.tscn" id="3_e236u"] [node name="MuyangDog" unique_id=1711205167 instance=ExtResource("1_y3l4w")] script = ExtResource("2_mr6nm") displayName = "牧羊犬" -[node name="Cogwheel" parent="weaponStore" parent_id_path=PackedInt32Array(1319091445) index="0" unique_id=89158644 instance=ExtResource("3_im5m5")] -offset_bottom = 688.0 - -[node name="Tree" parent="weaponStore" parent_id_path=PackedInt32Array(1319091445) index="1" unique_id=185228402 instance=ExtResource("4_im5m5")] +[node name="Volcano" parent="weaponStore" parent_id_path=PackedInt32Array(1319091445) index="0" unique_id=204992396 instance=ExtResource("3_e236u")] diff --git a/scripts/Contents/Bullets/HXD.gd b/scripts/Contents/Bullets/HXD.gd index 3488bd3..66fd6a9 100644 --- a/scripts/Contents/Bullets/HXD.gd +++ b/scripts/Contents/Bullets/HXD.gd @@ -10,14 +10,14 @@ var delta = 0.01 func spawn(): texture.play(str(randi_range(0, 2))) func ai(): - PresetBulletAI.forward(self, rotation) + PresetBulletAI.forward(self , rotation) func succeedToHit(_dmg: float, entity: EntityBase): if entity.isBoss: launcher.fields[FieldStore.Entity.DAMAGE_MULTIPILER] *= 1 + delta addTimes += 1 if is_instance_valid(lastHit): if lastHit.get_class() == entity.get_class(): - entity.bulletHit(self, true) + entity.bulletHit(self , true) lastHit = entity if bouncedTime < maxBouncedTime: var newEntity = EntityTool.findClosetEntity(position, get_tree(), !launcher.isPlayer(), launcher.isPlayer(), [entity]) diff --git a/scripts/Contents/Bullets/Parrier.gd b/scripts/Contents/Bullets/Parrier.gd index 956effc..ac603c0 100644 --- a/scripts/Contents/Bullets/Parrier.gd +++ b/scripts/Contents/Bullets/Parrier.gd @@ -9,19 +9,6 @@ var maxBallCount: int = 5 var atk: float = 1 var reflectRate: float = 1 -func parryEffect(bullet: BulletBase): - parryiedTimes += 1 - var eff = EffectController.create(ComponentManager.getEffect("Parry"), position + (bullet.position - position).normalized() * 200) # 从子弹位置,面向其他子弹的方向前进150 - eff.modulate = bullet.modulate.blend(bullet.texture.modulate) - eff.rotation = position.angle_to_point(bullet.position) - eff.shot() - launcher.impluse((position - bullet.position).normalized() * sqrt(abs(bullet.speed)) * 250) -func penerateEffect(entity: EntityBase, effPos: Vector2): - parryiedTimes += 1 - var eff = EffectController.create(ComponentManager.getEffect("ParryEntity"), effPos) - eff.rotation = entity.position.angle_to_point(effPos) - eff.shot() - entity.impluse((entity.position - effPos).normalized() * 450) func generateParryBall(bDamage: float): var cycler = launcher.getOrCreateCycleTimer("parry", 2000, 100) if len(cycler.bullets) < maxBallCount: # 玩家最多只能拥有多少气 @@ -47,7 +34,7 @@ func spawn(): eff.shot() func succeedToHit(_dmg: float, entity: EntityBase): if parryiedTimes < maxParryTimes && MathTool.rate(parryRate): - penerateEffect(entity, entity.position * 1.01) + ParryEntityEffect.createEffectEntity(entity, self ) func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞 if !is_instance_valid(launcher): return if BulletTool.canDamage(bullet, launcher): # 其他子弹可以使当前子弹的发射者受伤吗? @@ -57,8 +44,8 @@ func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞 # 魔法运动和召唤运动的子弹虽不能格挡,但是可以储能,吐息运动的子弹会对发射者产生击退 if bullet.motionType == BulletBase.MotionType.PROJECTILE: # 无论如何都要生成格挡特效 - parryEffect(bullet) - # 弹反 还是 格挡? + ParryEffect.createEffect(bullet, self ) + # 弹反 还是 格挡? if MathTool.rate(reflectRate): bullet.look_at(bullet.launcher.getTrackingAnchor()) bullet.launcher = launcher @@ -70,33 +57,33 @@ func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞 bullet.tryDestroy() generateParryBall(bullet.baseDamage) elif bullet.motionType == BulletBase.MotionType.SWING: - parryEffect(bullet) + ParryEffect.createEffect(bullet, self ) bullet.hitbox.set_deferred("disabled", true) generateParryBall(bullet.baseDamage) InternalDamageBullet.generateBall(launcher, bullet.launcher, atk) elif bullet.motionType == BulletBase.MotionType.STAB: - parryEffect(bullet) - penerateEffect(bullet.launcher, bullet.launcher.position * 1.01) + ParryEffect.createEffect(bullet, self ) + ParryEntityEffect.createEffectEntity(bullet.launcher, self ) bullet.hitbox.set_deferred("disabled", true) bullet.launcher.takeDamage(atk * reflectRate * bullet.getDamage()) bullet.launcher.impluse(Vector2.from_angle(bullet.rotation) * -2000) generateParryBall(bullet.baseDamage) InternalDamageBullet.generateBall(launcher, bullet.launcher, atk) elif bullet.motionType == BulletBase.MotionType.SPRINT: - parryEffect(bullet) + ParryEffect.createEffect(bullet, self ) bullet.tryDestroy() bullet.launcher.velocity *= 0 generateParryBall(bullet.baseDamage) for i in 2: InternalDamageBullet.generateBall(launcher, bullet.launcher, atk) elif bullet.motionType == BulletBase.MotionType.BREATH: - penerateEffect(bullet.launcher, launcher.position) + ParryEntityEffect.createEffectEntity(bullet.launcher, self ) bullet.launcher.impluse(Vector2.from_angle(bullet.rotation) * -500) elif bullet.motionType == BulletBase.MotionType.SUMMON || bullet.motionType == BulletBase.MotionType.MAGIC: - penerateEffect(bullet.launcher, launcher.position) + ParryEntityEffect.createEffectEntity(bullet.launcher, self ) launcher.storeEnergy(sqrt(bullet.baseDamage)) elif bullet.motionType == BulletBase.MotionType.EXPLOSION: - penerateEffect(bullet.launcher, launcher.position) + ParryEntityEffect.createEffectEntity(bullet.launcher, self ) for i in 2: InternalDamageBullet.generateBall(bullet.launcher, launcher, sqrt(bullet.getDamage())) else: diff --git a/scripts/Contents/Bullets/PipeBullet.gd b/scripts/Contents/Bullets/PipeBullet.gd index fb2ae5b..15ae3b7 100644 --- a/scripts/Contents/Bullets/PipeBullet.gd +++ b/scripts/Contents/Bullets/PipeBullet.gd @@ -4,7 +4,7 @@ class_name PipeBullet var energy: float = 0 func ai(): - PresetBulletAI.forward(self, rotation) + PresetBulletAI.forward(self , rotation) texture.rotation += initialSpeed * (1 - lifeTimePercent()) / 100 speed = initialSpeed * (1 - lifeTimePercent()) baseDamage = energy diff --git a/scripts/Contents/Bullets/RainbowCat.gd b/scripts/Contents/Bullets/RainbowCat.gd index 7683aa4..c13746b 100644 --- a/scripts/Contents/Bullets/RainbowCat.gd +++ b/scripts/Contents/Bullets/RainbowCat.gd @@ -2,7 +2,7 @@ extends BulletBase class_name RainbowCat func ai(): - PresetBulletAI.forward(self, rotation) + PresetBulletAI.forward(self , rotation) func succeedToHit(_dmg: float, _entity: EntityBase): EffectController.create(ComponentManager.getEffect("CatBoom"), position).shot() rotation_degrees = randf_range(0, 360) diff --git a/scripts/Contents/Bullets/RedCrystal.gd b/scripts/Contents/Bullets/RedCrystal.gd index 39eb782..c247ab1 100644 --- a/scripts/Contents/Bullets/RedCrystal.gd +++ b/scripts/Contents/Bullets/RedCrystal.gd @@ -8,12 +8,12 @@ var count: int = 0 func register(): hitbox.shape = hitbox.shape.duplicate() func ai(): - PresetBulletAI.forward(self, rotation) + PresetBulletAI.forward(self , rotation) speed = (1 - lifeTimePercent()) * initialSpeed func destroy(_beacuseMap: bool): hitbox.shape.radius = radius EffectController.create(ComponentManager.getEffect("RedCrystalExplosion"), global_position).shot() - if !is_instance_valid(launcher):return + if !is_instance_valid(launcher): return for i in randi_range(1, count): for bullet in BulletBase.generate(ComponentManager.getBullet("CrystalBlock"), launcher, position, deg_to_rad(randf_range(0, 360))): if bullet is CrystalBlockBullet: diff --git a/scripts/Contents/Bullets/Volcano.gd b/scripts/Contents/Bullets/Volcano.gd index e757f92..3a49bf2 100644 --- a/scripts/Contents/Bullets/Volcano.gd +++ b/scripts/Contents/Bullets/Volcano.gd @@ -16,8 +16,9 @@ func ai(): position.angle_to_point(launcher.currentFocusedPosition), rotates ) -func succeedToHit(_dmg: float, _entity: EntityBase): - EffectController.create(ComponentManager.getEffect("SwordCut"), textureSword.global_position).shot() +func succeedToHit(_dmg: float, entity: EntityBase): + entity.impluse((entity.getTrackingAnchor() - position).normalized() * 500) + ParryEntityEffect.createEffectEntity(entity, self ) func generateShadow(): var startAngle = rotation - deg_to_rad(count * splitAngle / 2) diff --git a/scripts/Contents/Effects/Parry.gd b/scripts/Contents/Effects/Parry.gd index adec65a..d7fd506 100644 --- a/scripts/Contents/Effects/Parry.gd +++ b/scripts/Contents/Effects/Parry.gd @@ -3,3 +3,11 @@ class_name ParryEffect func beforeShot(): CameraManager.shake(300, 500) + +static func createEffect(bullet: BulletBase, parrier: ParrierBullet): + parrier.parryiedTimes += 1 + var eff = EffectController.create(ComponentManager.getEffect("Parry"), parrier.position + (bullet.position - parrier.position).normalized() * 200) # 从子弹位置,面向其他子弹的方向前进150 + eff.modulate = bullet.modulate.blend(bullet.texture.modulate) + eff.rotation = parrier.position.angle_to_point(bullet.position) + eff.shot() + parrier.launcher.impluse((parrier.position - bullet.position).normalized() * sqrt(abs(bullet.speed)) * 250) diff --git a/scripts/Contents/Effects/ParryEntity.gd b/scripts/Contents/Effects/ParryEntity.gd index 7989404..ffdaefd 100644 --- a/scripts/Contents/Effects/ParryEntity.gd +++ b/scripts/Contents/Effects/ParryEntity.gd @@ -3,3 +3,11 @@ class_name ParryEntityEffect func beforeShot(): CameraManager.shake(50, 200) + +static func createEffectEntity(entity: EntityBase, by: BulletBase): + if by is ParrierBullet: + by.parryiedTimes += 1 + var eff = EffectController.create(ComponentManager.getEffect("ParryEntity"), entity.position) + eff.rotation = by.position.angle_to_point(entity.position) + eff.shot() + entity.impluse((entity.position - by.position).normalized() * 450)