summaryrefslogtreecommitdiff
path: root/Bullet.cs
blob: aeefd9445ef9a392e88fc6405846287ef064f4de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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;
    }
}