|
@@ -658,8 +658,12 @@ Enums
|
|
|
Enums are basically a shorthand for constants, and are pretty useful if you
|
|
|
want to assign consecutive integers to some constant.
|
|
|
|
|
|
-If you pass a name to the enum, it would also put all the values inside a
|
|
|
-constant dictionary of that name.
|
|
|
+If you pass a name to the enum, it will put all the keys inside a constant
|
|
|
+dictionary of that name.
|
|
|
+
|
|
|
+.. important: The keys in a named enum are not registered as global constants
|
|
|
+ in Godot 3.1 and later, they should be accessed prefixed by the
|
|
|
+ enum's name (``Name.KEY``). See example below.
|
|
|
|
|
|
::
|
|
|
|
|
@@ -672,10 +676,8 @@ constant dictionary of that name.
|
|
|
|
|
|
enum State {STATE_IDLE, STATE_JUMP = 5, STATE_SHOOT}
|
|
|
# Is the same as:
|
|
|
- const STATE_IDLE = 0
|
|
|
- const STATE_JUMP = 5
|
|
|
- const STATE_SHOOT = 6
|
|
|
const State = {STATE_IDLE = 0, STATE_JUMP = 5, STATE_SHOOT = 6}
|
|
|
+ # Access values with State.STATE_IDLE, etc.
|
|
|
|
|
|
|
|
|
Functions
|