shotgun recoil

pull/6/head
John Montagu, the 4th Earl of Sandvich 2023-08-15 21:49:33 -07:00
parent 87c6be6c1c
commit 673bebcabf
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
3 changed files with 9 additions and 0 deletions

View File

@ -67,6 +67,11 @@ public partial class ProjectileSpawner : Ranged
Vector2 target = Character.Target.Normalized();
if (CharacterRecoil > 0)
{
Character.ApplyImpulse(-target * CharacterRecoil);
}
// avoid unnecessary math if only spawning 1 projectile
if (ProjectileCount == 1)
{

View File

@ -4,6 +4,9 @@ namespace SupaLidlGame.Items.Weapons;
public abstract partial class Ranged : Weapon
{
[Export]
public float CharacterRecoil { get; set; } = 0;
[Export]
public float AngleDeviation { get; set; }

View File

@ -253,6 +253,7 @@ script = ExtResource("1_4xyyt")
Projectile = ExtResource("2_p3wx2")
ProjectileCount = 3
ProjectileAngleDeviation = 10.0
CharacterRecoil = 128.0
StateMachine = NodePath("State")
Damage = 12.0
UseTime = 1.5