updated instructions week2 enumerators
This commit is contained in:
parent
da5c7e61ba
commit
7e4fd00267
@ -97,6 +97,18 @@ var dollars : float :
|
||||
|
||||
This simple set of formatters convert the “dollars” value to store them in memory as cents.
|
||||
|
||||
### Enumerators
|
||||
|
||||
Enumerators are a collection that allows you to list out valid values for a property with a descriptive name.
|
||||
|
||||
For example, if you were making a 2D Platform game you might list out the directions your player character can be facing, like this:
|
||||
|
||||
```enum FaceDirection{LEFT, RIGHT}```
|
||||
|
||||
You could then use this enumerator to ensure a variable keeping track of your direction could no be assigned an invalid value like UP or DOWN.
|
||||
|
||||
```var facing:FaceDirection = FaceDirection.LEFT```
|
||||
|
||||
### Decorators
|
||||
|
||||
In Godot decorators can be used to control when a variable will be assigned. This is a convenience outside of placing the variable assignment in a function.
|
||||
|
Loading…
Reference in New Issue
Block a user