shotgun recoil

controller-support
HumanoidSandvichDispenser 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(); Vector2 target = Character.Target.Normalized();
if (CharacterRecoil > 0)
{
Character.ApplyImpulse(-target * CharacterRecoil);
}
// avoid unnecessary math if only spawning 1 projectile // avoid unnecessary math if only spawning 1 projectile
if (ProjectileCount == 1) if (ProjectileCount == 1)
{ {

View File

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

View File

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