Right now, if you use this function, it will always move the chest lid to the opposite position. Sometimes that is useful, but other times you won’t want the chest lid to close just because you told it to open but it was already open. To do this, we’ll use a parameter.
- In the
startLidAnimation, add a parameter called
Stringto specify the parameter’s type. In this case it’s a String, which is any collection of characters in “” quotes. We’ll be using “open” and “close” to make sure the animation goes the right way.