August 22, 2006
We are still very hard at work on the next release of SuperSpriteSurface — version 2.0! There are many new features in this release but we wanted to take a few minutes to post some details about two of them:
Among the new features added to version 2.0 are mouse events for SuperSprite objects and the SuperSpriteSurface control. This includes MouseDown, MouseDrag, & MouseUp, & built-in double-click support.
SuperSpriteSurface 2.0 also supports the concept of behavior objects — reusable objects that you can attach to any SuperSprite. Behaviors receive copies of the same events that SuperSprite objects receive; they alter the SuperSprite object they are attached to in some way. Example behavior could be motion or physics based, such as calculating the trajectory of a mass and handling collision with other masses — or even mouse event based: controlling the behavior of an object when it is clicked or dragged.
Behaviors can be called automatically by the SuperSpriteSurface engine or you can explicitly control when they are executed — swapping or enabling behaviors on the fly.
The most powerful aspect of this system is that you can apply a behavior to any SuperSprite object, instantly giving any of your sprites added functionality while only maintaining a single class encapsulating the behavior!
The movie below shows mouse interactivity and behaviors in action: Cards are dragged around the window; double-clicking “flips” the card over. The drag behavior of the card is controlled by a reusable drag behavior that rotates the card to follow the cursor’s direction. In this example, the rotation caused by the generic drag behavior is able to be overridden by the parent SuperSprite when the shift key is held down.