|
|
|
|
Reply From: |
Zylann |
First of all, if you are completely new to programming in general, I can understand that some aspects of scripting in Godot can be confusing. The documentation is not a programming tutorial, it implicitely requires some basic notions like variables, functions, a bit of inheritance and math.
Your question as been asked already, you can find some links here by doing a quick search: https://forum.godotengine.org/7981/any-good-tutorials?show=7981#q7981
more here: https://forum.godotengine.org/4335/where-find-godot-engine-tutorials-lets-collect-links-together?show=4335#q4335
If you need to chat with devs, you can ask on IRC: Kiwi IRC
or on this Godot Discord server: Godot Engine
About the images you posted:
-
When you see something.instance()
, it almost always means that something
is a PackedScene
. In fact, you will not find any other function having that name. You can see the word “instance” mixed in a lot of other places because “instance” is a programming concept, meaning that you create an object according to a model. In Godot, a PackedScene
contains information to build a scene. Using instance()
will create that scene, as many times as you want.
-
The second screenshot is an example of missing documentation, I agree it’s frustrating :s
Contributors are slowly improving it, it’s a huge game engine and it takes time to write all these help files (and even more to translate it in many languages).
-
In the third screenshot… well again, these are programming basics, however some of it is specific to the documentation:
-
void
: means the function returns vo value. For example, writing var result = the_function()
will not put anything into result
.
-
const
: this means the function will not modify the object it is used on. For example, on a Node2D, the function will not change anything in the node, just give you some information.
-
float
: in computers, this is how we commonly call a number that can have decimals (like 3.14 or 0.5). In the screenshot, it means the function returns that kind of number.
-
Vector2
: this is a math vector with an X and Y component. Unlike single numbers, you can use it to represent a position in two dimensions, or a direction. You can click on it and see its description.
-
pivot
: this is a parameter, the name usually depends on the function (it could be any name, as long as it’s relevant). The choice of “pivot” usually means it’s the center of something. In your case, that would be “where is the center of the node”.
A small addition to the answer:
If you are zero on programming, start with some python basics, that will help you to understand some of the tools.
If you are too young or your algebra is not your strong part, read a bit and be prepared to learn vector math while you do your games or prototypes.
When in Godot, go slowly with things, work on a basic game like a fixed shooter, one element at time, and start on paper, not on screen.
Game developing, as any programing related stuff, requires patience and to study (a lot sometimes).
Umm… Thanks for your answers and giving time to my question.
Sorry not to mention about my programming experince. Yeah I have coding knowlodge for years especially on Pyhton and Lua. However have no any C++ but some C# and Java. I think some part of or most part of Reference manual is based on C++
I had searched community of Godot from reddit to Facebook plus here but have never seen any related question with my statement. Then I asked it, off course don’t want to make here like topic garbage for other users.
You misunderstood me or I could not make a fine self expression for my condition (English is not my language if can not explain it, sorry). I just give these image as only examples of my general problem faced off scripting on Godot until now.
I may not connection Nodes and its elements or classes how to direct my game assets/player/events/conditions etc.
In images:
- first image one - how i decide on an element/func/method to use in any class? It’s related with Node that I used or related with my purpose and independent with used Node type.
if not appear >> Imgur: The magic of the Internet
-
second one - Related/familiar with first one.
-
third one- made me shame I did not mean brief of the float, vector2 etc. sorry for word explain “aggh English” :D. I already know them from Python-Lua and Panda3D-Löve2d. I asked it for the arrange of the elements. Why this arrangement is there. Please correct me If I’m right.
void, Vector2, float
shows type of element/method/func ?
get_node()
, etc. shows method or func ?
And when I see the parentheses-argument of any func there I really stuck An example:
Node get_node( NodePath path ) const
If it’s type is Node
why we have to point out again another type NodePath
into as an argument?
After Nodepath comes a parameter path
that you greatly explained and I think it’s very Pythonish manner that I can write it how I want. Thanks a lot you.
What I believe that discussion will generally solve my stuck points how to read docs an how to use them as I need .
*Godot is really great and I don’t want to go anywhere
linuxtopia | 2016-11-09 09:26
Nice
I have made that comment because Godot is attracting a lot of diverse people lately, old, young, programmers, designers, and many others, also people that comes from engines that require zero knowledge and leaves them with zero knowledge too…
Godot scripting and design is object oriented and you can see the SceneTree as a container of Node instances.
All derive from Object, so, some methods you can use can go up to Object (but you may use Node methods more).
-
If you check the script on Image 1, may see that enemy is probably a PackedScene
(loaded with load or preload), a PackedScene is like a composite class made of many nodes and scripts (that you normally save as scn or tscn file).
Once get an instance, these can be used like a any Node instance.
-
That get_node
method is inherited from the script class, it may extend a subclass of Node (first line of the script) and get the get_node from that.
-
Here Node get_node( NodePath path ) const
, as Zylann said is the form <return type> <method_name>(<parameter type> <parameter name>)
says you get a Node
(return type) with the method get_node
and a parameter “path” of type NodePath
.
If you search about the class NodePath
, it will give you a long explanation but basically you can use a String as NodePath too.
If you do:
var my_node = get_node( "string_path_to_my_node" )
Then, my_node will store a reference to the Node instance at “string_path_to_my_node”