GML Actor / Action model - GMWolf

GMWolf

aka fel666
GM Version: GameMaker:Studio 1/2
Target Platform: ALL
Download: N/A
Links: Youtube Video
Summary:
Improve your games architecture with a powerful tool: Actors and Actions. By splitting up your Game Objects and states, you can achieve highly flexible and expandable code.

Tutorial:

Note:
Many people have commented as to the efficiency of such a system. To those people, I say: You worry too much. Instance count is not where you should be focusing your attention. Have a look at algorithmic efficiency first. Or as Donald Knuth put it: "We should forget about small efficiencies".
 
Last edited by a moderator:
F

farkraj

Guest
I like this tutorial, its an interesiting approach to use instances like this. I usually use separate action scripts and my own data structures for state machines but using instances makes a lot of sense inside game maker right? where everything is almost constructed from instances. Anyway, nice idea of implementation.
 

GMWolf

aka fel666
How can I get the callback when the action done?
A simple script callback shouldn't be too difficult.

Have a simple variable that holds the script to execute ('callback' for example) and use script_execute on that variable when the action finishes.
something like this:
Code:
///Creating the action:
var action = instance_create_layer(...);
action.callback = do_something;

///on action finished
script_execute(callback);
 

Zhanghua

Member
A simple script callback shouldn't be too difficult.

Have a simple variable that holds the script to execute ('callback' for example) and use script_execute on that variable when the action finishes.
something like this:
Code:
///Creating the action:
var action = instance_create_layer(...);
action.callback = do_something;

///on action finished
script_execute(callback);
excellent gotcha!
 
Top