how to script dead men
This is one of those problems you can solve yourself, but I've noticed you often get things to work faster by posting about them here on the board than by thinking about and solving them yourself. (hurrah for fast responses)
The deal is that after I kill this man I want his death pic to stick on the screen, and I want to come back later to drink his blood and talk about nonsense. (in other words I want to attach a script to the dead man long after he's been killed)
So, er H eh, please someone tell me a good way to do this without wasting too many globals.
The deal is that after I kill this man I want his death pic to stick on the screen, and I want to come back later to drink his blood and talk about nonsense. (in other words I want to attach a script to the dead man long after he's been killed)
So, er H eh, please someone tell me a good way to do this without wasting too many globals.
You could always you the editor_seq trick.
Something like this:
void main ( void )
{
int &ed = sp_editor_num(¤t_sprite);
int &dead = editor_seq(&ed, -1);
if (&dead == 1)
{
//be dead
} else
{
//be alive
}
}
void die ( void )
{
editor_seq(&ed, 1);
}
The only catch is that the corpse would warp back to the place the guy started. You could use editor_seq and editor_frame to store the X and Y he was killed at if you think it's worth the trouble, btu be aware that editor_frame onyl goes up to 255, so even if that's Y, you'd have to cut the number in half before storing it and double it before using it.
Something like this:
void main ( void )
{
int &ed = sp_editor_num(¤t_sprite);
int &dead = editor_seq(&ed, -1);
if (&dead == 1)
{
//be dead
} else
{
//be alive
}
}
void die ( void )
{
editor_seq(&ed, 1);
}
The only catch is that the corpse would warp back to the place the guy started. You could use editor_seq and editor_frame to store the X and Y he was killed at if you think it's worth the trouble, btu be aware that editor_frame onyl goes up to 255, so even if that's Y, you'd have to cut the number in half before storing it and double it before using it.