Make arrows remain on fire if bow was set on fire

pull/43/head
John Montagu, the 4th Earl of Sandvich 2024-08-26 00:24:15 -07:00
parent c8e21d3642
commit fad5370c20
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
2 changed files with 24 additions and 12 deletions

View File

@ -16,7 +16,14 @@ public partial class Bow : ProjectileSpawner
if (_isOnFire) if (_isOnFire)
{ {
GetNode<AnimatedSprite2D>("%Flame").Visible = false; var flame = GetNode<AnimatedSprite2D>("%Flame");
var newFlame = flame.Duplicate() as Node2D;
projectile.AddChild(newFlame);
newFlame.Position = Vector2.Zero;
flame.Visible = false;
// TODO: instead of doing 1.5x damage, create an "On Fire" debuff // TODO: instead of doing 1.5x damage, create an "On Fire" debuff
projectile.Hitbox.Damage *= 1.5f; projectile.Hitbox.Damage *= 1.5f;
_isOnFire = false; _isOnFire = false;
@ -31,12 +38,15 @@ public partial class Bow : ProjectileSpawner
_ignitionArea = GetNode<Area2D>("IgnitionArea"); _ignitionArea = GetNode<Area2D>("IgnitionArea");
var onAreaEntered = (Area2D area) => var onAreaEntered = (Area2D area) =>
{ {
var flame = GetNode<AnimatedSprite2D>("%Flame"); if (!_isOnFire)
flame.Visible = true; {
flame.GetNode<AudioStreamPlayer2D>("Ignite") var flame = GetNode<AnimatedSprite2D>("%Flame");
.OnWorld() flame.Visible = true;
.PlayOneShot(); flame.GetNode<AudioStreamPlayer2D>("Ignite")
_isOnFire = true; .OnWorld()
.PlayOneShot();
_isOnFire = true;
}
}; };
_ignitionArea.Connect( _ignitionArea.Connect(
Area2D.SignalName.AreaEntered, Area2D.SignalName.AreaEntered,

View File

@ -95,7 +95,7 @@ tracks/1/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1),
"update": 0, "update": 0,
"values": [Vector2(15, -8)] "values": [Vector2(15, -4)]
} }
tracks/2/type = "value" tracks/2/type = "value"
tracks/2/imported = false tracks/2/imported = false
@ -166,7 +166,7 @@ tracks/2/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1),
"update": 0, "update": 0,
"values": [Vector2(15, -8)] "values": [Vector2(15, -4)]
} }
tracks/3/type = "value" tracks/3/type = "value"
tracks/3/imported = false tracks/3/imported = false
@ -221,7 +221,7 @@ tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5), "times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1), "transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1, "update": 1,
"values": [Vector2(15, -8), Vector2(14, -8), Vector2(13, -8), Vector2(12, -8), Vector2(11, -8), Vector2(9, -8)] "values": [Vector2(15, -4), Vector2(14, -4), Vector2(13, -4), Vector2(12, -4), Vector2(11, -4), Vector2(9, -4)]
} }
[sub_resource type="Animation" id="Animation_j5qtq"] [sub_resource type="Animation" id="Animation_j5qtq"]
@ -263,7 +263,7 @@ tracks/2/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1),
"update": 0, "update": 0,
"values": [Vector2(15, -8)] "values": [Vector2(15, -4)]
} }
tracks/3/type = "value" tracks/3/type = "value"
tracks/3/imported = false tracks/3/imported = false
@ -372,9 +372,11 @@ hframes = 8
unique_name_in_owner = true unique_name_in_owner = true
visible = false visible = false
modulate = Color(3, 3, 3, 1) modulate = Color(3, 3, 3, 1)
position = Vector2(15, -8) position = Vector2(15, -4)
sprite_frames = SubResource("SpriteFrames_b2khh") sprite_frames = SubResource("SpriteFrames_b2khh")
autoplay = "default" autoplay = "default"
frame_progress = 0.1652
offset = Vector2(0, -4)
[node name="PointLight2D" type="PointLight2D" parent="Anchor/Flame"] [node name="PointLight2D" type="PointLight2D" parent="Anchor/Flame"]
color = Color(1, 0.8, 0.701961, 1) color = Color(1, 0.8, 0.701961, 1)