T
Toxicosis
Guest
That, pretty much.
I created a parent, obj_enemy, that has a create event to initialize some variables, then a step event that passes an argument off to one shared script for all the enemies. Every enemy starts with behaviour = 0, then in the specific enemy object I add another behaviour in the create event.
The behaviour_execute and behaviour_initialize files are getting darned huge tho, even using subscripts to reduce some complicated routines, and I'm not even beginning. I might have to start using separate scripts for some classes of enemies, and that seems inefficient.
If there's a better way, I'd like to hear about it, so... How do you organize AIs yourself?
I created a parent, obj_enemy, that has a create event to initialize some variables, then a step event that passes an argument off to one shared script for all the enemies. Every enemy starts with behaviour = 0, then in the specific enemy object I add another behaviour in the create event.
Code:
//Parent, Create Event:
behaviour = 0;
abnormal_behaviour = 0;
//Note that the parent also has a shared draw event by which I set anything "enemy" to have an editable sprite, which I can flip without meddling too much with the actual xscale.
//Child, create event
event_inherited();
behaviour_select(X);
//Parent, step event
behaviour_select(behaviour);
//behaviour_select
if X != behaviour
behaviour_initialize(X)
else behaviour_execute(X)
//behaviour_initialize
a_lottabit_general_stuff = initial_value;
switch argument0
{
case X:
{
behaviour=X;
another_lottabit_stuff = other_initial_value;
break;
}
}
//behaviour_perform(X)
switch argument0
{
//This is X. He's an enemy. He does X things.
case X:
{
do_X_stuff;
break;
}
}
If there's a better way, I'd like to hear about it, so... How do you organize AIs yourself?
Last edited by a moderator: