#What is wrong with my code?
1 messages · Page 1 of 1 (latest)
Read each word of the error very carefully and it will help; you have a typo (but the compiler doesn't know enough to know how to tell you that)
you spelled "strength" "strenght"
thank you and that is my bad for not seeing that
But what does GDnativescriptclass mean?
It's what things like Input actually turn into -- https://github.com/godotengine/godot/blob/master/modules/gdscript/gdscript.h -- while compiling etc. My guess is that Input is created programmatically and doesn't have all the nice debug bells and whistles a real class should have when compiled from real code
(see your transpositional typo again -- it's GDScript Native Class, not GDNative Script Class)
what is the differnce between a script class and a native class
infact what is a class anyway???
Also you could just use Input.get_vector instead
what would the diffence be?
And you should do the character movement in _physics_process(), not _process()
It'd simplify your whole get_input function down to one line
It makes a normalized vector2 for you
Why would I do this? I am wondering what would the benefit would be?
also how did you learn godot yourself?
its like everyone seems to know so much about it
Move and slide is a physics function, it should be called in physics process to work right. Plus you don't need to run all this every graphics frame, only every physics frame
"difference script class and native class" -- anything you write in a .gd file (and a few places else...) is an instance of a GDScript, and when you attach it to a node that node is called an instance of your script. A GDSCriptNativeClass is not well exposed and hidden; it's something from the engine ("native" meaning "native to the executing platform") exposed as though it were GDScript. Like Input!
"what is a class" -- you're going to need to do some homework! I recommend working through https://gdscript.com/tutorials/ -- the last lesson answers your question 🙂
Process is the fps dependent graphics frame callback, with highly variable frame timings, code in there gets called on every frame draw. Physics process runs at a slightly more stable fixed 60/s (by default, but still use delta where appropriate just in case it lags), and is where all the physics body processing (like collisions and characterbody2d movement) happens
Not sure if calling move_and_slide outside of _physics_process will give you a warning, but it'll probably cause collision bugs or other weirdness
TLDR: characterbody movement is physics stuff so it goes in _physics_process
then what is the other stuff that is not physics?