0 votes

Hello,

Could you please point me in the right direction to find the resources which will help me migrate old GDscript code to a newer version. (I am new to coding)

Example, I did a tutorial on YouTube to "Make a Space Shooter" and the instructor used Godot 2.x, I wish to convert it to a newer Godot engine and make changes. I could not find much info on the errors I am encountering and wish to learn how to do the migration.

I often find tutorials which are not using the latest Godot version and wish to migrate the code to one of the newer Godot engines.

Some conversions are easy, ie. getpos = getposition but others more cryptic like func findnode(node):
Function signature doesn't match the parent. Parent signature is: 'Node find
node(String, bool=default, bool)'

Reference: Make a Space Shooter Game in Godot
URL: https://www.youtube.com/watch?v=EteQMVK2joI

Also, would using GDNative code like C, C++, C# be a decent workaround?

Thanks for any advice you can give,
GodotUser

in Engine by (93 points)

2 Answers

+1 vote

For 2.x to 3
I have found this: Migration notes Godot 2 -> Godot 3 (found here)

Basically the the most important change was the way of how to access variables and nodes:

2.x:  get_node("NodeName").get_position()
      get_node("NodeName").set_position(new_position)
3.x:  $NodeName.position

For 3.0 -> 3.1:
See this question for more information:
Is there anything special to know to migrate a project from 3.0 to 3.1?

If you have more time you can look at the release-post. The biggest change for gdscript was of course optional typing.

Hope that gave you some hints,
Jowan-Spooner

by (774 points)

Thanks for the information.

I changed the first findnode to findparent as seen below:

func findparent(node):
return self.main
node.find_node(node)
pass

  • not sure why the author chose to use pass in addition to code in the function, I left it as is. FYI, * these early issues I hit are in the utils.gd provided here.

My change above "appeared" to resolve the issue , then hit another issue:
var mainnode setget , _getmainnode
var view
size setget , getviewsize
var mouse
pos setget , getmouse_pos

Still researching it. =D

I just bought the Udemy course "Discovering Godot..." so I can learn more about how gdscript works =D

+1 vote

if you haven't done it yet take a look here:

https://github.com/dploeger/godot-migrationnotes

Regards.
-j

by (1,461 points)
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.