Intro to 3D Game Development

0 of 193 lessons complete (0%)

Scripting Part 1: Moving Objects

Create a New Function

You don’t have access to this lesson

Please register or sign in to access the course content.

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.

  1. Below the tick function, create a new function called moveChest
    • moveChest(){}
  2. Select all the code in the tick function and cut and paste it between the { } of the moveChest function.
Everything from the tick function is now in moveChest