Objects

Mana is object-oriented by design. Creating software in Mana is accomplished by arranging virtual “objects” into a sequence and then pressing the “play” button.

So what the heck is a virtual object?

In Mana, a virtual object is simply a name with some data attached to it. The data can represent an image, a model…your Aunt Irma’s oatmeal cookie recipe…anything! Objects are usually composed of other objects and can be very simple or very complex.

Every object has an update method, or a set of instructions that tells it what to do. When you call Update() on the first object, it automatically calls the same routine on all of its child objects, and they each call it on their child objects, etc. This “cascade effect” is how the application progresses and usually it happens over and over again in a loop until some condition is met (e.g. the user closes the app).

What do you mean by “child” objects?

Typically, objects are organized in one of two ways. The Mana interface provides a directory, like folders on your hard drive, where objects can be browsed just like files. In addition, there are some objects that can have others linked to them in a parent-child hierarchy.

All objects have a class (ification) that defines common features. Only objects belonging to certain classes can have child objects because they share that feature. Objects that can have children are derived from Mana’s Linkable class, which is an abstract. Abstract objects are explained in the next article.

Almost all objects can be children. However, it is up to each class to decide restrictions. If you had an object of class “person” and another of class “car,” you might want to restrict objects of class “foot” and class “tire” so that they attach appropriately and you don’t end up with a person’s tire and a car’s foot!