using System; using System.Collections.Generic; using System.ComponentModel; using Godot; using Godot.Bridge; using Godot.NativeInterop; [ScriptPath("res://Scripts/Bullets/BasicGravity.cs")] public partial class BasicGravity : Node2D, IBullet { [Export(PropertyHint.None, "")] public Vector2 direction; [Export(PropertyHint.None, "")] public Vector2 gravity = new Vector2(0f, 0.05f); [Export(PropertyHint.None, "")] public float time = -100f; [Export(PropertyHint.None, "")] public float rotate; public bool grazed { get; set; } public Node2D node { get; set; } [Export(PropertyHint.None, "")] public int HP { get; set; } = 1; public AnimationPlayer anim { get; set; } public BulletGenerator generatedFrom { get; set; } [Export(PropertyHint.None, "")] public IBullet.Type type { get; set; } public Action onShot { get; set; } public override void _Process(double delta) { if (time > -50f) { time -= Main.deltaTime; if (time <= 0f) { QueueFree(); } } if (rotate != 0f) { base.RotationDegrees += rotate * Main.deltaTime; } direction += gravity * Main.deltaTime; base.GlobalPosition += direction * Main.deltaTime; } }