© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
2 replies
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);
        }
    }
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);
        }
    }
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

why does this Not work?
C#CC# / help
3y ago
✅ why doesn't this work?
C#CC# / help
3y ago
❔ Why does this not work?
C#CC# / help
3y ago