PRAction is a GameMaker Studio 2 (GMS) module created by Prismatic Realms, Inc. It is an action/animation system that is similar to a tweening system, but is so much more than that. At its very basic level, PRAction allows you to modify an object's properties from one value to another over time, but it takes this concept several steps further. The idea is that you create "action" objects, each of which represent a specific object property changing from one value to another over a given amount of time. Then you can package any number of these actions together into complex groups and sequences that, when played by a object, will be executed like an action script from a movie. Actions, and groups of actions, can be played in a loop and repeated any number of times. Furthermore, actions are reusable. So when you create an action, you can keep it around to use over and over on any number of your game objects.
Any of your object's properties can be animated in this way. PRAction gives you many functions that allow you to animate their x/y positions, alpha value, rotation angle, scaling factors and much more. You can also animate your object's colour properties to transition from one colour to another smoothly. On top of that, you can also animate any of your own custom variables that you've added to your objects.
It doesn't end there. Properties can be animated "absolutely", meaning that you specify the "to" value that the property will animate to from it's current value. But you can also animate properties "relatively" so that rather than animating those properties TO any given value, you animate they BY a given value instead. PRAction includes a bunch of animation curve functions, also known as easing functions, that will animate those properties using a variety of different smoothing effects.
And if that isn't enough, there's more! Actions don't only have to involve modifying properties over time. There is an action that allows you to insert a "wait" command into your "movie script" to add pauses in between your actions. Actions can also be one-shot instant triggers! Such as running a script function, object method or user event, or playing a sound effect, destroying an object, running a room, changing an object's draw layer, or even instructing another object's actions to start playing at key points in your action sequence.
As a bonus, this extension includes several common and useful compound actions, ready to use in your project. These include floating, shaking, blinking, flashing, flipping, wobbling and more. Use them as is, or as examples to create your own compound actions.
PRAction will save you tons of time when coding your animations. There is nothing to it: First, you define the actions and then you instruct an object to play those actions. That's it! There is no messing about with alarms, or tracking frame counts or anything else. Just play it, and then forget it.
The sky's the limit with this extension. Animate anything to your heart's desire.
This package contains a parent object that implements PRAction that your objects can derive from as well as several script assets that contain the functions you use to create actions and animate your object properties. The package also contains documentation on how to use the module and example code that you can learn from.
Friendly support is just an email away and you can expect a quick turn-around to answer your questions and resolve issues. As always, comments and suggestions are welcome!
The included examples feature artwork by Penusbmic (used with permission.)
-Added PRActionDestroyObject function. Creates an action that will destroy the current object. -Added PRActionGotoRoom function. Creates an action that runs the given room. -Minor changes to JDOC descriptions.
NEW FEATURES * Added new action creation function PRActionCreateCallFunction() and matching type constant PRACTION_TYPE_CALL_FUNCTION.
IMPROVEMENTS * Minor changes to documentation and JSDocs. * Hidden all "only referenced once" syntax errors. It's natural to not use every defined variable in a module. * Removed DebugExt script. Decided it was overkill. * Added default values to all optional function parameters. * Resolved several Feather warnings. * Enhanced JSDOC documentation.
BUG FIXES * Moved the definition of the _PRActionStruct constructor method out of the oPRAction object and into its own script so that it is a globally defined function instead. It didn't belong in the oPRAction object * Added event_inherited() call in all object events.
NOTES * Moved module registry implementation out to a different module as it isn't needed here. Kept a single non-impactful function call to register the module, for PR use only.