To finish the chest animation, we’ll create a new function and move our code into it, so that it’s easy to read and use later. You can create functions like tick and start by giving them a name, and using ( )
for any inputs the function might need and { }
for all the code that is part of the function.
- Below the
tick
function, create a new function calledmoveChest
moveChest(){}
- Select all the code in the
tick
function and cut and paste it between the{ }
of themoveChest
function.
