prework for buff system
parent
996b49ab93
commit
00be67d787
|
@ -396,16 +396,6 @@ public partial class Character : CharacterBody2D, IFaction
|
||||||
bus.EmitSignal(Events.EventBus.SignalName.PlayerHit, newArgs);
|
bus.EmitSignal(Events.EventBus.SignalName.PlayerHit, newArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
/// <summary>
|
|
||||||
/// For debugging purposes
|
|
||||||
/// </summary>
|
|
||||||
public void Inflict(float damage)
|
|
||||||
{
|
|
||||||
OnReceivedDamage(damage, null, 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Plays a footstep sound. This should be called through an
|
/// Plays a footstep sound. This should be called through an
|
||||||
/// <c>AnimationPlayer</c> to sync sounds with animations.
|
/// <c>AnimationPlayer</c> to sync sounds with animations.
|
||||||
|
|
|
@ -693,6 +693,8 @@ libraries = {
|
||||||
"": SubResource("AnimationLibrary_kks2p")
|
"": SubResource("AnimationLibrary_kks2p")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[node name="Buffs" type="Node2D" parent="."]
|
||||||
|
|
||||||
[node name="Effects" type="Node2D" parent="."]
|
[node name="Effects" type="Node2D" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
radius = 20.0
|
radius = 20.0
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bw3hg"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bw3hg"]
|
||||||
size = Vector2(20, 23)
|
size = Vector2(20, 16)
|
||||||
|
|
||||||
[node name="Campfire" type="StaticBody2D"]
|
[node name="Campfire" type="StaticBody2D"]
|
||||||
texture_filter = 3
|
texture_filter = 3
|
||||||
|
@ -46,7 +46,6 @@ offset_bottom = -19.0
|
||||||
text = "Clone Machine"
|
text = "Clone Machine"
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(0, -3.5)
|
|
||||||
shape = SubResource("RectangleShape2D_bw3hg")
|
shape = SubResource("RectangleShape2D_bw3hg")
|
||||||
|
|
||||||
[editable path="InteractionTrigger"]
|
[editable path="InteractionTrigger"]
|
||||||
|
|
|
@ -43,8 +43,8 @@ public partial class Projectile : RigidBody2D
|
||||||
[Export]
|
[Export]
|
||||||
public double Delay { get; set; } = 0;
|
public double Delay { get; set; } = 0;
|
||||||
|
|
||||||
[System.Obsolete]
|
[Export(PropertyHint.File, "*.tscn")]
|
||||||
public Character Character { get; set; }
|
public Godot.Collections.Array<string> Buffs { get; set; }
|
||||||
|
|
||||||
public Items.Weapon Weapon { get; set; }
|
public Items.Weapon Weapon { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=11 format=3 uid="uid://c1w7t6irnohfx"]
|
[gd_scene load_steps=12 format=3 uid="uid://c1w7t6irnohfx"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://har1bd5u4dq3" path="res://Assets/Sprites/Misc/torch.png" id="1_14bgb"]
|
[ext_resource type="Texture2D" uid="uid://har1bd5u4dq3" path="res://Assets/Sprites/Misc/torch.png" id="1_14bgb"]
|
||||||
[ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="2_hotvd"]
|
[ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="2_hotvd"]
|
||||||
|
@ -60,6 +60,9 @@ animations = [{
|
||||||
"speed": 10.0
|
"speed": 10.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_ljsf5"]
|
||||||
|
radius = 4.0
|
||||||
|
|
||||||
[node name="Torch" type="Node2D"]
|
[node name="Torch" type="Node2D"]
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
@ -77,3 +80,12 @@ shadow_filter_smooth = 3.0
|
||||||
texture = ExtResource("2_hotvd")
|
texture = ExtResource("2_hotvd")
|
||||||
offset = Vector2(0, 2)
|
offset = Vector2(0, 2)
|
||||||
texture_scale = 0.25
|
texture_scale = 0.25
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
position = Vector2(0, -8)
|
||||||
|
collision_layer = 128
|
||||||
|
collision_mask = 0
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||||
|
shape = SubResource("CircleShape2D_ljsf5")
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.Items.Weapons;
|
||||||
|
|
||||||
|
public partial class Bow : ProjectileSpawner
|
||||||
|
{
|
||||||
|
protected bool _isOnFire = false;
|
||||||
|
|
||||||
|
protected Area2D _ignitionArea;
|
||||||
|
|
||||||
|
protected override void SpawnProjectile(Scenes.Map map,
|
||||||
|
Vector2 direction, float velocityModifier = 1)
|
||||||
|
{
|
||||||
|
base.SpawnProjectile(map, direction, velocityModifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
base._Ready();
|
||||||
|
_ignitionArea = GetNode<Area2D>("IgnitionArea");
|
||||||
|
_ignitionArea.AreaEntered += (Area2D area) =>
|
||||||
|
{
|
||||||
|
_isOnFire = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=15 format=3 uid="uid://cgg0sfm2qeiwn"]
|
[gd_scene load_steps=16 format=3 uid="uid://cgg0sfm2qeiwn"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dam6aigkw8xs" path="res://Assets/Sprites/Items/bow-and-arrow.png" id="1_1ghvv"]
|
[ext_resource type="Texture2D" uid="uid://dam6aigkw8xs" path="res://Assets/Sprites/Items/bow-and-arrow.png" id="1_1ghvv"]
|
||||||
[ext_resource type="Script" path="res://Items/Weapons/ProjectileSpawner.cs" id="1_76bur"]
|
[ext_resource type="Script" path="res://Items/Weapons/ProjectileSpawner.cs" id="1_76bur"]
|
||||||
|
@ -109,6 +109,8 @@ _data = {
|
||||||
"idle": SubResource("Animation_riv7t")
|
"idle": SubResource("Animation_riv7t")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_6b356"]
|
||||||
|
|
||||||
[node name="Bow" type="Node2D" node_paths=PackedStringArray("StateMachine")]
|
[node name="Bow" type="Node2D" node_paths=PackedStringArray("StateMachine")]
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
script = ExtResource("1_76bur")
|
script = ExtResource("1_76bur")
|
||||||
|
@ -170,3 +172,12 @@ libraries = {
|
||||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||||
volume_db = -8.0
|
volume_db = -8.0
|
||||||
bus = &"Effects"
|
bus = &"Effects"
|
||||||
|
|
||||||
|
[node name="IgnitionArea" type="Area2D" parent="."]
|
||||||
|
position = Vector2(8, 0)
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 128
|
||||||
|
monitorable = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="IgnitionArea"]
|
||||||
|
shape = SubResource("CircleShape2D_6b356")
|
||||||
|
|
|
@ -24,7 +24,8 @@ public partial class ProjectileSpawner : Ranged
|
||||||
[Export]
|
[Export]
|
||||||
public float ProjectileAngleDeviation { get; set; }
|
public float ProjectileAngleDeviation { get; set; }
|
||||||
|
|
||||||
private void SpawnProjectile(Scenes.Map map, Vector2 direction, float v = 1)
|
protected virtual void SpawnProjectile(Scenes.Map map,
|
||||||
|
Vector2 direction, float velocityModifier = 1)
|
||||||
{
|
{
|
||||||
var projectile = map.SpawnEntity<Entities.Projectile>(Projectile);
|
var projectile = map.SpawnEntity<Entities.Projectile>(Projectile);
|
||||||
projectile.Hitbox.Faction = Character.Faction;
|
projectile.Hitbox.Faction = Character.Faction;
|
||||||
|
@ -33,7 +34,7 @@ public partial class ProjectileSpawner : Ranged
|
||||||
|
|
||||||
if (ShouldOverrideVelocity)
|
if (ShouldOverrideVelocity)
|
||||||
{
|
{
|
||||||
projectile.Speed = InitialVelocity * v;
|
projectile.Speed = InitialVelocity * velocityModifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShouldRotate)
|
if (ShouldRotate)
|
||||||
|
|
Loading…
Reference in New Issue