0 votes

I recently migrated to Godot from Gamemaker, and due to the lack of learning content compared to Gamemaker, the learning curve is rather rough. How would you call an object? Like if my player collides with it or if I want to edit a private variable?

in Engine by (16 points)

1 Answer

0 votes

There is a lot of Godot learning material available. One of the best places to start is the official documentation at http://docs.godotengine.org/en/3.0/ . Especially the Step by step section which includes a walk-through making a small, complete game. It is designed to show you how to do a lot of the most common tasks in Godot.

Objects can be referenced by their location in the scene tree, or depending on what you're doing, object references are returned by various node functions. For example, if you're using a KinematicBody2D, when it collides with another object it returns a collision object that includes a reference to the colliding body. It's hard to answer your question specifically because there are so many possible situations.

One other comment: in GDScript there is no such thing as a private variable or method. Much like Python, you can access any property or method of an object, and the general convention is to use an underscore (ie, _varname) to indicate the property should be considered private.

by (20,475 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.