Behaviors |

Version Compare

Back to page history

Version User Scope of changes
Jul 24 2009, 4:13 PM EDT (current) dale.beermann 50 words deleted
Jul 24 2009, 4:13 PM EDT dale.beermann 34 words added, 46 words deleted, 3 photos added, 3 photos deleted

Changes

Key:  Additions   Deletions
Behaviors are the glue that holds your application together. They describe the control flow and logic by listing the actions that occur in your application based on well defined events.

For example, you can create new game enemies every N seconds of the game. Or you can create a behavior that will let your users select objects with the mouse.

Those are just two simple examples. You have access to every public property of every object in your creation from within a behavior. This provides very powerful tools for creating fun and engaging content for your users.

World and Application Behaviors

world and app behaviorsHigh-level behaviors that manage the flow of an application are typically created at a global level - "on the Application" or "on the World" as we will typically say.

Although these behaviors are really no different from a behavior created on an individual object, it's nice to organize your application control flow here.

Common use cases for games include:
  • Controlling when a game is started or ended
  • Controlling when the game's level changes
  • Dynamically creating or destroying objects in the World
  • Collecting data via web services when the game starts
  • Managing keyboard input
  • Managing mouse input

The World's behaviors are created and edited by clicking on the Directory characher and choosing "Behavior..."


Object Behaviors

The logic that defines how an object interacts with the rest of the World are typically defined directly on the object.

class access


You aren't required to manage any of the physics or image rendering for the object (we do all of that for you), but you can define things like, "When the plane crashes into the ground, play an explosion sound and destroy it."

Common use cases for games include:
  • Define what happens when two objects collide
  • Define what happens when the user clicks on the object
  • Define what happens when the object is created or destroyed
  • Define what happens when the object is modified by some other behavior
  • Define what happens to the object based on a timer.

An object's behaviors are created and edited by clicking on the respective object and choosing "Behavior..." from the drop down menu.



Managing Behavior Groups

When the behavior dialog is launched (from an object or the World), you are presented with a list of all behaviors currently defined on the respective element.
  • To create a new behavior, click the "Add" button.
  • To edit an existing behavior, click on the behavior to select it and then click on the "Edit" button.
  • To delete an existing behavior, click on the behavior to select it and then click on the "Delete" button.

behavior list

Anatomy of a Behavior

Get an overview of the behavior editor's interface.


Guidlines for Referencing Objects

The flexibility of the behavior editor provides a wide variety of ways to reference objects within a behavior. These are some guidelines that we recommend for efficiency, reliability, and portability.

Action Definition

Action definitions declare what happens when a behavior is run. Get an overview of the actions available.


Filter Definition

Filter definitions determine when a behavior is executed. Get an overview of the filters available.

  • View Now

Input BrowserThe input browser provides access to action definitions, objects, object properties, logic and math operators, and functions. Get an overview of the browser's features.View NowFunctionsFunctions represent well encapsulated action sets that can be re-used within behaviors and applications. Get an overview of functions.View Now