I am using C# in Godot, with Visual Studio as my external editor. I'm curious as to why it won't work, but also isn't giving me a single error message.

`using Godot;
using System;

public partial class sprite : Sprite2D
{
public override void _Ready()
{
SetProcess(true);
}
public void Process(float delta)
{
float AMOUNT = 5;
if (Input.IsKeyPressed(Key.W))
{
this.Position += new Vector2(0, -AMOUNT);
GD.Print("W key pressed. Position: " + this.Position);
}
if (Input.IsKeyPressed(Key.S))
{
this.Position += new Vector2(0, AMOUNT);
}
if (Input.IsKeyPressed(Key.A))
{
this.Position += new Vector2(-AMOUNT, 0);
}
if (Input.IsKeyPressed(Key.D))
{
this.Position += new Vector2(AMOUNT, 0);
}
}
}
`
I am brand new so there could be some rookie mistake in here. Any and all help is appreciated <3

(If it's important, I have also used Windows 11's copilot to help me debug, and so far it's helped remove all my errors I was getting before, but it still will not work.)

  • xyz replied to this.

    Have you checked the Godot Docs? they have instructions for both GDscript and C# , so I'd recommend taking a look at it!

    The issue is most likely your lack of a Speed variable, plus personally I'd use a CharacterBody2D node, it's easier. I'd recommend checking THIS GD code for reference, it might prove useful to you!

    slipssy Processing callback must be named _Process. Otherwise it won't be called automatically every frame as expected. Your code is calling it Process (it's missing the leading underscore).

      xyz I have replaced Process with _Process and nothing has changed. My sprite will still not move. Any idea why?

      To replace a function like _Process you need to do two main things: use the override keyword and match the signature (you can't change return or parameter types).
      Without override and with a float delta, the engine doesn't recognise your function as the one it should be calling.

      public override void _Process(double delta)

        Kojack Thank you! This fixed it for me! Really appreciate it <3