From 4a34595a975a7c7c0db254811a10a168d0bd22c9 Mon Sep 17 00:00:00 2001 From: HumanoidSandvichDispenser Date: Sat, 3 Jun 2023 14:02:40 -0700 Subject: [PATCH] projectile lifetime --- Entities/Projectile.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Entities/Projectile.cs b/Entities/Projectile.cs index 7996bc1..8e157c8 100644 --- a/Entities/Projectile.cs +++ b/Entities/Projectile.cs @@ -17,8 +17,19 @@ namespace SupaLidlGame.Entities [Export] public Hitbox Hitbox { get; set; } + [Export] + public double Lifetime { get; set; } = 10; + public Character Character { get; set; } + public override void _Process(double delta) + { + if ((Lifetime -= delta) <= 0) + { + QueueFree(); + } + } + public override void _PhysicsProcess(double delta) { Vector2 velocity = Velocity;