0 votes

can someone give me a quick overview on how godot script work like
-why is there an extend at the top of the script and
-if there is an extend shouldn't the code be all inherited classes instead of predefined functions?

in Engine by (30 points)

1 Answer

+1 vote

A GDScript file is a class. The extends line identifies what base class the script is extending.

I'm not sure what your second question means at all.

You can start learning about GDScript here: https://docs.godotengine.org/en/latest/getting_started/step_by_step/scripting.html#introduction

by (20,677 points)

first of all iam glad you responded and my second questions meant if GDScript is a class why isn't the whole code extends from it we will write class ready instead of function ready

The question still doesn't make sense. func defines function (also called a method) belonging to the class. Writing class would define a new class.

It seems that you may not understand how object oriented programming works. Here are a few links that may help:

https://dev.to/charanrajgolla/beginners-guide---object-oriented-programming
https://www.youtube.com/watch?v=wfcWRAxRVBA

Since Godot is strongly object-oriented, it's important to understand OOP, as well as other basic programming concepts.

Thanks for the answer of payload505. Have some question

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.