0 votes

What are the enumerations? I saw that they are named in the documentation

in Engine by (183 points)

1 Answer

0 votes

Hi,
enumerations or short enum are a collection of numbered literal constants.

Just like

const MY_CONST = 234

but enums are defiened differently

enum {TILE_BRICK, TILE_WATER, TILE_SKY}

then TILEBRICK would be 0 TILEWATER = 1 and so on

If you would want more structured code you can do

enum tiles {TILE_BRICK, TILE_WATER, TILE_SKY}

Then tiles.TILE_BRICK would be 0 etc.

and since they are constant they are static too
MyCustomClass.tiles.TILE_BRICK is also accessible

by (3,874 points)
edited by

I could do it with the body entered signal of an area to detect when there is something over this?

How do we know enums are static? I can make another question if need be.

Well ... they are. Like any other constant in gd script

Ok, thank you :)

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.