diff --git a/components/Bullets/Parrier.tscn b/components/Bullets/Parrier.tscn index 3c9a9b8..f974b34 100644 --- a/components/Bullets/Parrier.tscn +++ b/components/Bullets/Parrier.tscn @@ -19,7 +19,7 @@ tracks/0/keys = { [sub_resource type="Animation" id="Animation_li4th"] resource_name = "spawn" -length = 0.5 +length = 0.3 step = 0.01 tracks/0/type = "bezier" tracks/0/imported = false @@ -29,8 +29,8 @@ tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { "handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.1, 0, 0, -0.5, 0, 0, 0), -"times": PackedFloat32Array(0, 0.5) +"points": PackedFloat32Array(1, -0.25, 0, 0.1, 0, 0, -0.3, 0, 0, 0), +"times": PackedFloat32Array(0, 0.3) } [sub_resource type="AnimationLibrary" id="AnimationLibrary_k4ctn"] @@ -41,7 +41,7 @@ _data = { [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_li4th"] radius = 60.0 -height = 200.0 +height = 300.0 [node name="Parrier" instance=ExtResource("1_57y3f")] script = ExtResource("2_li4th") @@ -60,6 +60,6 @@ libraries = { } [node name="hitbox" parent="." index="1"] -position = Vector2(100, 0) +position = Vector2(150, 0) rotation = 1.5707964 shape = SubResource("CapsuleShape2D_li4th") diff --git a/components/Effects/Parrier.tscn b/components/Effects/Parrier.tscn index c545064..0a5438e 100644 --- a/components/Effects/Parrier.tscn +++ b/components/Effects/Parrier.tscn @@ -17,7 +17,7 @@ libraries = { } [node name="texture" parent="stage" index="1"] -position = Vector2(150, 50) +position = Vector2(200, 50) scale = Vector2(-0.4, 0.4) sprite_frames = ExtResource("2_7outc") frame = 8 diff --git a/components/Effects/Parry.tscn b/components/Effects/Parry.tscn index 6b4d21b..15760e5 100644 --- a/components/Effects/Parry.tscn +++ b/components/Effects/Parry.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=25 format=3 uid="uid://bwbhxnuhmkwww"] +[gd_scene load_steps=26 format=3 uid="uid://bwbhxnuhmkwww"] [ext_resource type="PackedScene" uid="uid://bcvuuy2m0pke0" path="res://components/Abstracts/EffectBase.tscn" id="1_vc7s4"] +[ext_resource type="Script" uid="uid://mirrohsweqtb" path="res://scripts/Contents/Effects/Parry.gd" id="2_471em"] [ext_resource type="Texture2D" uid="uid://bdvyebq7sepqf" path="res://resources/effects/parry/ParrySparkAccurate0.png" id="2_kic6n"] [ext_resource type="AudioStream" uid="uid://caxopva6lrlm3" path="res://resources/sounds/effect/swordhit.ogg" id="2_l0pl0"] [ext_resource type="Texture2D" uid="uid://7jhhyoinptns" path="res://resources/items/soul.svg" id="3_buxs5"] @@ -98,6 +99,7 @@ animations = [{ }] [node name="Parry" instance=ExtResource("1_vc7s4")] +script = ExtResource("2_471em") spawnSound = "spawn" spawnTexture = "spawn" lockTexture = true diff --git a/scripts/Contents/Bullets/Parrier.gd b/scripts/Contents/Bullets/Parrier.gd index 1683d24..9ea9b59 100644 --- a/scripts/Contents/Bullets/Parrier.gd +++ b/scripts/Contents/Bullets/Parrier.gd @@ -20,6 +20,14 @@ func spawn(): eff.texture.scale.x *= -1 eff.texture.sprite_frames = frames eff.shot() +func succeedToHit(_dmg: float, entity: EntityBase): + if parryiedTimes < maxParryTimes: + parryiedTimes += 1 + var eff = EffectController.create(ComponentManager.getEffect("Parry"), entity.position) + eff.rotation = position.angle_to_point(entity.position) + eff.shot() + launcher.impluse((position - entity.position).normalized() * 600) + entity.impluse((entity.position - position).normalized() * 600) func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞 if BulletTool.canDamage(bullet, launcher): # 其他子弹可以使当前子弹的发射者受伤吗? if parryiedTimes < maxParryTimes && MathTool.rate(parryRate): # 一个刀光最多格挡多少个敌方子弹? @@ -29,7 +37,6 @@ func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞 eff.modulate = bullet.modulate.blend(bullet.texture.modulate) eff.rotation = position.angle_to_point(bullet.position) eff.shot() - CameraManager.shake(250, 300) launcher.impluse((position - bullet.position).normalized() * (bullet.speed * bullet.getDamage()) ** (1.0 / 3) * 250) var targetBaseDamage = bullet.baseDamage # 弹反 还是 格挡? diff --git a/scripts/Contents/Effects/.gitkeep b/scripts/Contents/Effects/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/scripts/Contents/Effects/Parry.gd b/scripts/Contents/Effects/Parry.gd new file mode 100644 index 0000000..98fabe4 --- /dev/null +++ b/scripts/Contents/Effects/Parry.gd @@ -0,0 +1,5 @@ +extends EffectController +class_name ParryEffect + +func beforeShot(): + CameraManager.shake(200, 300) diff --git a/scripts/Contents/Effects/Parry.gd.uid b/scripts/Contents/Effects/Parry.gd.uid new file mode 100644 index 0000000..c124fd0 --- /dev/null +++ b/scripts/Contents/Effects/Parry.gd.uid @@ -0,0 +1 @@ +uid://mirrohsweqtb diff --git a/scripts/Contents/Wave.gd b/scripts/Contents/Wave.gd index 0f46de1..973bb61 100644 --- a/scripts/Contents/Wave.gd +++ b/scripts/Contents/Wave.gd @@ -49,7 +49,7 @@ static var WAVE_JUSTJOKE = [ Wave.create("Kernyr", 0, 0, true, 0, INF, 1), ] static var WAVE_EMPTY = [] -static var waveConfig = [WAVE_JUSTJOKE, 10] +static var waveConfig = [WAVE_NORMAL, 1] static var current: int = startWith(1) if WorldManager.isRelease() else startWith(waveConfig[1]) static var data = WAVE_NORMAL if WorldManager.isRelease() else waveConfig[0] diff --git a/scripts/Statemachine/EffectController.gd b/scripts/Statemachine/EffectController.gd index 6dba323..14efb3f 100644 --- a/scripts/Statemachine/EffectController.gd +++ b/scripts/Statemachine/EffectController.gd @@ -20,6 +20,7 @@ func _physics_process(_delta): if lockTexture: texture.global_rotation = 0 func shot(): + beforeShot() var childParticle = particles.duplicate() as GPUParticles2D childParticle.emitting = true add_child(childParticle) @@ -48,6 +49,8 @@ func shot(): func register(): pass +func beforeShot(): + pass static func create(scene: PackedScene, spawnPosition: Vector2, parent: Node = null) -> EffectController: var cloned = scene.instantiate() as EffectController