using Godot; public partial class ThrowPillow : Node2D { [Export] public PackedScene pillow; [Export] public Node pillowsNode; [Export] public float RPM = 30f; private float countdown = 0f; // Called when the node enters the scene tree for the first time. public override void _Ready() { pillow = GD.Load("res://Scenes/Entities/pillow.tscn"); } // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(double delta) { countdown -= (float)delta; if (countdown > 0f) return; ShootPillow(); countdown = 60f / RPM; } private void ShootPillow() { var instance = pillow.Instantiate(); instance.GlobalPosition = GlobalPosition; pillowsNode.AddChild(instance); } }