In the next steps, we’ll add code to close the chest lid again. In order to do that, we need a variable that keeps track of whether the chest is currently open.
- Above the
start
function, create a new private variable namedisOpen
. - Set it to
false
initially. - In the
openChest
function, set it totrue
in the else-statement after the animation finishes.