C#C
C#2y ago
FloW

✅ Why doesnt "this." work here?

public override void _Ready()
    {
        float StepLenght = 5;
        if (Input.IsKeyPressed((int)KeyList.W)){
            this.Position += new Vector2(0, -StepLenght);
        }
        if (Input.IsKeyPressed((int)KeyList.S)){
            this.Position += new Vector2(0, StepLenght);
        }
        if (Input.IsKeyPressed((int)KeyList.D)){
            this.Position += new Vector2(StepLenght, 0);
        }
        if (Input.IsKeyPressed((int)KeyList.A)){
            this.Position += new Vector2(-StepLenght, 0);
        }
    }
Was this page helpful?