I get the above error a lot, though not always with the same phrases within the apostrophes. And, rather than asking what is wrong with my code every single time, I figured it would be more useful if I just asked here how I could troubleshoot this error.

I've looked around on docs.godotengine.org a bunch for this exact error, but I haven't found anything useful so far. But, since I'm so new to programming it's entirely likely I'm just using the wrong keywords since I can't make sense of a lot of it just yet.

Any help would be majorly appreciated!

  • Godot uses object oriented programming, which means it is based on classes. A class can be things you use in the editor, like Sprite or Spatial, or they code be all in code. int is a built-in class for integers (whole numbers). Classes can have functions (methods) that are attached to them. In this case, you are calling a method called move_toward, but that function does not exist inside int. It might belong to another classes, such as Vector2 or KinematicBody. Most likely it means you mixed up a variable, or you assigned the wrong value to it (overwrote it with something else, which can change the class type).

Godot uses object oriented programming, which means it is based on classes. A class can be things you use in the editor, like Sprite or Spatial, or they code be all in code. int is a built-in class for integers (whole numbers). Classes can have functions (methods) that are attached to them. In this case, you are calling a method called move_toward, but that function does not exist inside int. It might belong to another classes, such as Vector2 or KinematicBody. Most likely it means you mixed up a variable, or you assigned the wrong value to it (overwrote it with something else, which can change the class type).

    cybereality
    Ahhh right right, thank you for explaining, it makes sense now!
    I had indeed changed velocity to 0 as a placeholder to just make the npc stand still for a bit, thereby changing it to an integer. It's fixed now, thanks again!

    Using static typing helps avoid that kind of mistake. You get an immediate warning message if you try to change the type of a variable.