diff options
Diffstat (limited to 'Bullet.cs')
| -rw-r--r-- | Bullet.cs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Bullet.cs b/Bullet.cs new file mode 100644 index 0000000..aeefd94 --- /dev/null +++ b/Bullet.cs @@ -0,0 +1,16 @@ +using Godot; + +public partial class Bullet : Area2D +{ + [Export] public float Speed { get; set; } = 600.0f; + + // The player script will set this direction when the bullet spawns + public Vector2 Direction { get; set; } = Vector2.Zero; + + public override void _PhysicsProcess(double delta) + { + // Move the bullet over time. + // We multiply by delta to ensure movement is framerate-independent. + Position += Direction * Speed * (float)delta; + } +}
\ No newline at end of file |
