Testing the Type of an Object

If you need to determine whether an object is of a certain type, you can use the method is from Object.tz. The method takes a single keyword, "a", such that the method call can be written:

    item is a "Dog".

The call returns the int value 1 if the item is of the specified type, or 0 otherwise. This would most likely be part of an if statement:

    if (item is a "Dog"): item roll-over.

This method is useful in collision callbacks or when examining neighbors in order to determine the appropriate action.