Godot has vector types, Vector2
and Vector3
. They can represent points, directions or sizes, in 2D and 3D. You can get the individual components by writing the_vector.x
or the_vector.y
. They can be negative depending on what the vector represents. If it's a size, it will always be positive. If it's a direction or a point, it can be negative.
For example, the size of a texture is obtained with its get_size()
function, which you call like the_texture.get_size()
. It returns a Vector2
. That means the width of the texture is the_texture.get_size().x
. There are lots of other properties in Godot working this way.
In case you want the size of the screen, you can get it with get_viewport().get_size()
, where get_size()
also returns a Vector2
. In the case of viewports, it can also be shortened as .size
: https://docs.godotengine.org/en/3.1/classes/class_viewport.html#class-viewport-property-size
If you need something else, please explain better^^
Also, this may be useful to learn more about vectors: https://docs.godotengine.org/en/3.1/tutorials/math/vector_math.html#vector-math