#What is wrong with my code?

1 messages · Page 1 of 1 (latest)

scarlet patio
#

Also I would like to know how to fix it if I encounter the error again.

silver crown
#

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"

scarlet patio
#

thank you and that is my bad for not seeing that

#

But what does GDnativescriptclass mean?

silver crown
#

(see your transpositional typo again -- it's GDScript Native Class, not GDNative Script Class)

scarlet patio
#

what is the differnce between a script class and a native class

#

infact what is a class anyway???

nova meadow
#

Also you could just use Input.get_vector instead

scarlet patio
#

what would the diffence be?

nova meadow
#

And you should do the character movement in _physics_process(), not _process()

nova meadow
#

It makes a normalized vector2 for you

scarlet patio
#

also how did you learn godot yourself?

#

its like everyone seems to know so much about it

nova meadow
silver crown
# scarlet patio what is the differnce between a script class and a native class

"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 🙂

nova meadow
#

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

scarlet patio
#

then what is the other stuff that is not physics?

nova meadow
#

Everything else?

#

There's also the _input() callback you can use for when you want something to trigger immediately, but only on an input event, not checking for it every frame, which is useful for like for UI events and stuff.