updated instructions week2 enumerators

This commit is contained in:
OddlyTimbot 2025-08-11 16:04:21 -04:00
parent da5c7e61ba
commit 7e4fd00267

View File

@ -97,6 +97,18 @@ var dollars : float :
This simple set of formatters convert the “dollars” value to store them in memory as cents. 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 ### 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. 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.