Functions

Functions are found under the Methods panel of the Code Window in Alice. They are used to ask questions about properties of objects.

For example, there is a function that will tell you the height of an object. You could then use that to tell a person to stand on the tallest object. You can also find out things like the distance to an object, its vehicle, whether it is colliding with something else and much more.

keypoints

Some functions are Boolean functions. That is they return a value of true or false.

For example the isFacing function will give a value of true if one object is facing the other object, or it will return false if the objects are not facing each other.

 

This video will show you how you can get one object to move close to another using getDistanceTo. The code used is below the video.

 

Activity - Functions

Explore the functions for different objects in your scene.

Build your own animation that uses a function.

Don't forget to include comments in your code.

 

home   left arrow   right arrow