1. Where should I put death animations
4. Maybe throw in an explanation on how to add in factions with their own unique units
1.i havent done that yet, so theres no place to put them yet.
4.just make it so units can only build particular buildings, which have 1 factions units.
eg. faction1 peon can only build fac_1_baracks, and that building can only build fac_1_marines
whereas a faction2 peon can only build fac_2_baracks, and that building can only build unit_zerglings and unit_drones.
1. I've successfully put some death animations in this engine but haven't worked the bugs out yet.
In the create event of the unit I have something like this:
/*var*/ state_anim[7,0] = spr_man_downright_death; // for death
/*var*/ state_anim[7,1] = spr_man_downright_death;
/*var*/ state_anim[7,2] = spr_man_upright_death;
/*var*/ state_anim[7,3] = spr_man_upright_death;
/*var*/ state_anim[7,4] = spr_man_upleft_death;
/*var*/ state_anim[7,5] = spr_man_upleft_death;
/*var*/ state_anim[7,6] = spr_man_downleft_death;
/*var*/ state_anim[7,7] = spr_man_downleft_death;
/*var*/ state_anim[8,0] = spr_man_downright_dead; // for deadness
/*var*/ state_anim[8,1] = spr_man_downright_dead;
/*var*/ state_anim[8,2] = spr_man_upright_dead;
/*var*/ state_anim[8,3] = spr_man_upright_dead;
/*var*/ state_anim[8,4] = spr_man_upleft_dead;
/*var*/ state_anim[8,5] = spr_man_upleft_dead;
/*var*/ state_anim[8,6] = spr_man_downleft_dead;
/*var*/ state_anim[8,7] = spr_man_downleft_dead;
then, in the step event, I have this somewhere near the end(although I probably do more than I need to here):
if unit_hp <= 0
{
ally_units = obj_nothing;
attacking = false;
gathering = false;
able_to_move = false;
can_gather = false;
can_attack = false;
ispeon = false;
attack_mode = false;
state = 7;
image_speed = .5;
if state = 7 && image_index = gath_spr_length
{
state = 8;
image_speed = 1;
if state = 8 && image_index = gath_spr_length
{
instance_destroy();
tmp = instance_create(x,y,obj_unit_body);
tmp.var_direction = direction;
}
if selected = true
{
global.number_of_selected -= 1;
}
}
It seems to work intermittently, but I can't get the dead body to appear facing the correct direction.
4. regarding factions, I'd like to know how to make a computer controlled ally faction which attacks enemy computer controlled units in this engine, but doesn't attack your units, and another one that attacks both enemies and your units.
5. There is some sort of bug, where the number of frames in the sprite selected for a unit(in the drag and drop window) affects the number of frames animated for that unit. For example, if the unit sprite(the one displayed in the map editor) has 10 frames, and the walk animation has 8 frames, the walk animation will play frames 1,2,3,4,5,6,7,8,1,2 and then repeat(which is bad), but the 10 frame attack animation plays all 10 frames and then repeats (which is good). If the unit sprite has 8 frames, the 8 frame walk animation will play all 8 frames and repeat (which is good), but the 10 frame attack animation will only play frames 1,2,3,4,5,6,7,8 and then repeat without ever playing frames 9 & 10(which is bad). So I try to keep the number of frames the same for each state by removing 2 of the attack frames, and making the unit sprite have the same number of frames as the walk and attack animations, and that seems to work, but it would be nice if there was a better way to deal with that.
Edited by stumlehb, 13 March 2011 - 06:20 PM.