Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | aggsol | |
Old Version | Published before Godot 3 was released. |
Will GDScript differ largely in Godot compared to 2.1?
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | aggsol | |
Old Version | Published before Godot 3 was released. |
Will GDScript differ largely in Godot compared to 2.1?
Reply From: | volzhs |
Some of classes and functions will be renamed or deprecated.
And there will be enhanced script features.
Take a look at Juan’s twitter.
https://twitter.com/reduzio
Reply From: | Zylann |
Not very much on the language itself, but a few things will:
Instead of get_pos()
, you’ll be able to simply write position
. Same for other things that were “properties” on nodes but that needed get_
and set_
to be read and changed.
_process
, _fixed_process
, _input
etc will be called by default if they are present in the script, no need to explicitely set_process(true)
etc anymore.
Dictionaries will be sorted by key insertion order when using a for
loop to iterate over them. So I guess if you load some JSON you will get keys in the same order as encountered in the JSON file. While I don’t like this (due to performance hit even when you don’t need it) it can come handy in several cases.
A more efficient syntax to iterate between 0 and N:
for i in 10: # same as for i in range(0, 10)
print(str(i))
range
was creating an array behind the scenes, the new syntax does it without.
Also, a lot of classes and function names will change (but that goes beyond GDScript). For a more detailed list of compatibility breakage, you can have a look at this doc Godot 3.0 breakage - Google Tabellen
Dictionaries will be sorted by key insertion order when using a for loop to iterate over them. So I guess if you load some JSON you will get keys in the same order as encountered in the JSON file.
nice, i didnt like doing that by hand
ingo_nikot | 2017-01-12 15:36