The Dink Network

Question: How to change a sprite?

January 24th 2005, 03:52 PM
peasantmg.gif
Raven
Peasant He/Him Sweden
 
Hello!
I want to change a sprite (when Dink is hitting it), to another sprite (and it may not change back). How can this be done? Which are the commands to use in this case?

regards
Raven
January 24th 2005, 04:09 PM
wizardg.gif
chaotic
Peasant He/Him
 
void hit( void )
{
sp_seq(&current_sprite, #)
}
January 24th 2005, 04:16 PM
spike.gif
Please be a little more specific? I'm not sure what exactly you mean. If you like to make Dink run a seq you should do like this:

sp_seq(1, #seq);
sp_frame(1, 1);
if Dink is unfreezed when you do it you propably want this too:
sp_nocontrol(1, 1);

EDIT: Oh now I *think* I see what you mean.
sp_pseq(&current_sprite, #seq);
sp_pframe(&current_sprite, #frame);
if you want to make it stay that way without wasting globals something like this should work:
editor_type(&current_sprite, #type);
editor_seq(&current_sprite, #seq);
editor_frame(&current_sprite, #frame);
January 24th 2005, 04:25 PM
peasantmg.gif
Raven
Peasant He/Him Sweden
 
Ok
Right now, the script look like this. It is attached to the shelf with pots from the standard sprite library (in slot 64 , sprite number 1). I want to change it to a sprite I have loaded from
my graphics folder, to slot 66, sprite number 65.

The script:

void main( void )
{
}

void talk( void )
{
if (&ming < 2)
{
say_stop("A nice collection of ming vases.", 1);
wait(100);
}
if (&ming >= 2)
{
say_stop("A nice collection of ming sherds.", 1);
wait(100);
}
}

void hit (void)
{
if (&ming == 1)
{
&ming = 2;
// Exchange the sprites here somehow

say_stop(" Ha ha, just sherds, you will be fired, stupid port guard! ", 1);
wait(100);
}
if (&ming == 0)
{
say_stop(" I will not destroy anything with out a reason!", 1);
}
}
January 24th 2005, 04:32 PM
spike.gif
void main( void )
{
if (&ming > 1)
{
sp_pseq(&current_sprite, 66);
sp_pframe(&current_sprite, 65);
//If the hardnesses of the two sprites differ from each other and you want to change it then the next command too.
draw_hard_sprite(&current_sprite);
}
}

void talk( void )
{
if (&ming < 2)
{
say_stop("A nice collection of ming vases.", 1);
wait(100);
}
if (&ming >= 2)
{
say_stop("A nice collection of ming sherds.", 1);
wait(100);
}
}

void hit (void)
{
if (&ming == 1)
{
&ming = 2;
sp_pseq(&current_sprite, 66);
sp_pframe(&current_sprite, 65);
//If the hardnesses of the two sprites differ from each other and you want to change it then the next command too.
draw_hard_sprite(&current_sprite);

say_stop(" Ha ha, just sherds, you will be fired, stupid port guard! ", 1);
wait(100);
}
if (&ming == 0)
{
say_stop(" I will not destroy anything with out a reason!", 1);
}
}

Is that what you want? Or do you want a bottle on the shelf to break when you hit the shelf? :confused:
January 24th 2005, 04:35 PM
spike.gif
In the latter case...

void main( void )
{
if (&ming > 1)
{
int &vase = sp(65);
sp_pseq(&vase, 66);
sp_pframe(&vase, #frame);
}
preload_seq(66);
}

void talk( void )
{
if (&ming < 2)
{
say_stop("A nice collection of ming vases.", 1);
wait(100);
}
if (&ming >= 2)
{
say_stop("A nice collection of ming shreds.", 1);
wait(100);
}
}

void hit (void)
{
if (&ming == 1)
{
&ming = 2;
int &vase = sp(65);
sp_pseq(&vase, 66);
sp_pframe(&vase, #frame);

say_stop(" Ha ha, just shreds, you will be fired, stupid port guard! ", 1);
wait(100);
}
if (&ming == 0)
{
say_stop(" I will not destroy anything with out a reason!", 1);
}
}
January 24th 2005, 06:02 PM
peasantmg.gif
Raven
Peasant He/Him Sweden
 
I works now, thanks for the help!