Explosions
I've done a sprite that can walk around as he wishes, but I want an explosion to appear ON him when I talk to him... The problem is he's moving the whole time, is it possible to spawn the explosion on him there he stands after walking around by himself?
Yes. It is easy. You just make two variables for x and y coordinates and use sp_x(¤t_sprite,-1) and the same with sp_y to get the coordinates that you can give the new sprite, also using sp_x and sp_y, but on the newly created explosion sprite, or in the create_sprite. I can show you:
void talk()
{
int &man_x = sp_x(¤t_sprite,-1);
int &man_y = sp_y(¤t_sprite,-1);
int &manexplode = create_sprite(&man_x,&man_y,int brain,int sequence,int frame);
// if you use a shadow brain, then the explosion will follow the man's movements if he continues to move. Hehe, imagine the man just sets himself on fire when you talk. You can add more commands under here, for example if you want the man dead or if you want to give the explosion sprite more properties.
}
void talk()
{
int &man_x = sp_x(¤t_sprite,-1);
int &man_y = sp_y(¤t_sprite,-1);
int &manexplode = create_sprite(&man_x,&man_y,int brain,int sequence,int frame);
// if you use a shadow brain, then the explosion will follow the man's movements if he continues to move. Hehe, imagine the man just sets himself on fire when you talk. You can add more commands under here, for example if you want the man dead or if you want to give the explosion sprite more properties.
}
Ok thanks, and if I want the explosion to just appear once and then disappear I could use brain 7?
Yep. But you'll probably have to call sp_seq(&manexplode, int seq); to actually start the animation.