You may have noticed the variable someNumber
above the start
function in your code. We can make one for the amount we want the chest to move up so that it’s easy to change and adjust later.

- Change the name of the variable,
someNumber
, toamountToMoveUp
. - Change the value of the variable from 42 to 10.
- In the start function, change the amount you add to the chest’s y position from 10 to
this.amountToMoveUp
.
Note: Why ‘this’ this time?
When you make a variable above the start function, it becomes a property of the script, so you need to write this
. to find it. We’ll look at ways to make variables that don’t need a this
later in the lesson.