using Godot; namespace Tutorial1.Scripts; public partial class Character : Sprite2D { // private Timer clock; // [Signal] // public delegate void MovedEventHandler(float x, float y); // public override void _Ready() { // // clock = GetNode("Clock"); // // clock.WaitTime = 1; // // clock.Timeout += ClockOnTimeout; // // clock.Start(); // // Moved += (x, y) => GD.Print($"Moved by x={x}, y={y}."); // } // private void ClockOnTimeout() { // Vector2 newPosition = new(GD.RandRange(0, 500), GD.RandRange(0, 500)); // Position = newPosition; // EmitSignal("Moved", newPosition.X, newPosition.Y); // } public override void _UnhandledInput(InputEvent @event) { if (@event is InputEventMouseButton { Pressed: true } buttonEvent) Position = buttonEvent.GlobalPosition; } }