Command crashes Dink
void main( void )
{
sp_seq(¤t_sprite, 449);
sp_sound(¤t_sprite, 34);
sp_brain(¤t_sprite, 6);
sp_hitpoints(¤t_sprite, 0);
}
void hit( void )
{
&save_x = sp_x(¤t_sprite, -1);
&save_y = sp_y(¤t_sprite, -1);
if (sp_brain(¤t_sprite, -1) == 6)
{
playsound(50, 22050, 0, 0, 0);
sound_set_kill(34);
sp_brain(¤t_sprite, 0);
return;
}
//rest of the script
The sound_set_kill(); command crashes the game. Why is that? I've never tried that command before, am I doing it wrong??
BTW, is there a way to make the savebot instantly stop on the frame it's on when Dink hits it? I can't think of anything better than disabling the sprite and pasting the pic on it...
{
sp_seq(¤t_sprite, 449);
sp_sound(¤t_sprite, 34);
sp_brain(¤t_sprite, 6);
sp_hitpoints(¤t_sprite, 0);
}
void hit( void )
{
&save_x = sp_x(¤t_sprite, -1);
&save_y = sp_y(¤t_sprite, -1);
if (sp_brain(¤t_sprite, -1) == 6)
{
playsound(50, 22050, 0, 0, 0);
sound_set_kill(34);
sp_brain(¤t_sprite, 0);
return;
}
//rest of the script
The sound_set_kill(); command crashes the game. Why is that? I've never tried that command before, am I doing it wrong??
BTW, is there a way to make the savebot instantly stop on the frame it's on when Dink hits it? I can't think of anything better than disabling the sprite and pasting the pic on it...
sound_set_kill() uses a sound's number as input. This number is the value of &sound in:
&sound = playsound(whatever);
Just like you use &sprite = create_sprite(whatever);
My guess is that it crashes because there aren't 34 sounds playing.
A way to stop the animation of the savebot would be:
void hit( void )
{
&crap = sp_pframe(¤t_sprite, -1);
sp_brain(¤t_sprite, 0);
sp_pframe(¤t_sprite, &crap);
}
This basically stops the animation and gives the sprite the last frame. You have to place an "int &crap" in the main proc.
&sound = playsound(whatever);
Just like you use &sprite = create_sprite(whatever);
My guess is that it crashes because there aren't 34 sounds playing.
A way to stop the animation of the savebot would be:
void hit( void )
{
&crap = sp_pframe(¤t_sprite, -1);
sp_brain(¤t_sprite, 0);
sp_pframe(¤t_sprite, &crap);
}
This basically stops the animation and gives the sprite the last frame. You have to place an "int &crap" in the main proc.
So, basically, I can't kill a sound that's attached to a sprite without killing the sprite?? And sp_pframe(); won't stop the animation...
Heh, sp_sound(¤t_sprite, 0); seems to that... I feel myself a little stupid now. Something I find weird though, is that the following crashes Dink as well:
sp_disabled(¤t_sprite, 1);
sp_brain(¤t_sprite, 0);
int &pic = sp_pframe(¤t_sprite, -1);
int &replica = create_sprite(&save_x, &save_y, 0, 449, &pic);
It doesn't matter though, it's better that the machine goes off when you hit it than stop at the last frame, it's just weird..
sp_disabled(¤t_sprite, 1);
sp_brain(¤t_sprite, 0);
int &pic = sp_pframe(¤t_sprite, -1);
int &replica = create_sprite(&save_x, &save_y, 0, 449, &pic);
It doesn't matter though, it's better that the machine goes off when you hit it than stop at the last frame, it's just weird..
pframe is zero, unless you set it AFAIK. Have you tried sp_frame instead?
Try the sp_picfreeze() command, use 1 to free the frame and 0 to unfreeze it.