Appearance
get_rand_sprite_with_this_brain
Prototypeint get_rand_sprite_with_this_brain(int brain, int active_sprite_ignore)
get_next_sprite_with_this_brain()
returns a random active sprite number that is on the screen with sp_brain() brain. It will not include active_sprite_ignore
, so a sprite can check for other brains of its type if needed. If no matching sprite is found, 0 is returned.
Used by the dragons to target the town folk in the original game.
c
//excerpt from en-drag.c
&mtarget = get_sprite_with_this_brain(16, ¤t_sprite);
if (&mtarget > 0)
{
&mtarget = get_rand_sprite_with_this_brain(16, ¤t_sprite);
sp_target(¤t_sprite, &mtarget);
}