Functional Methods Overview

• The Methods panel of the Alice 3 Code Editor contains the tiles used for the creation of the program code.

• The Methods panel has two tabbed sections, Procedures and Functions.

• Functions can generally be described as methods that that ask a question or compute a value.

 

Procedural Methods and the Object Menu

• The Functions tab will display the functions available for the object selected in the Object Menu found at the top of the methods panel.  

• The Objects Menu displays the objects that have been added to the scene. 

• It should be noted that the keyword this refers to the Scene object.

• Different objects may have different functional methods available to them. 

 

Procedural Methods and the Editor 

• The Editor provides a drag-and-drop environment where functional method tiles are dragged into the edit space..  

o Unlike procedures, however, functions are not standalone instructions but rather are expressions that generate a value that can be used as arguments to procedures or other expressions.

o To add a function to your program all you need to do is drag it into the code editor panel to the appropriate location for the argument.

o Alice will highlight valid locations for the function.

• When a function is added to the code editor a series of sub-menus may appear depending on the arguments required.  

o Default values have been added to the drop down but there will also be a custom input option that allows you to type or use a number input to choose your own value.  

o Alice requires you to fill these out so that the code is always complete and functional.  

 

Editing a Functional Method

• Functions may be modified by clicking on the yellow argument components that have a small arrow next to them.  Selecting these components will bring up a drop-down menu showing the available options for substitution.

• A function may be deleted from the editor by replacing it with a different value, expression or function call.

• Right-clicking on a procedural instruction tile in the editor will provide replacement options, or you may drag and drop another function into its place 

 

Categories of Functional Methods

• Appearance / Size – referring to properties of the selected character or prop.

• Prompt user – allow the program to ask the user to provide information from the keyboard for more interactive programs.

• Position – provide information about an objects location in the scene, either its distance from other objects or where it is in relationship to other objects

o It should be noted that the getDistanceTo function will return the distance, in meters form the center point of one object to the center point of the target object

o The other distance functions (getDistanceAbove, getDistanceToTheRightOf, etc) are dependant on the orientation of the respective objects

• Other – provides useful information about the properties of an object, or its relationship to other objects

• Joint – functions that return the specified joint of an object.  Access to these joints is used primarily to animate parts of a character or object.