The Dink Network

Prob creating sprite

May 30th 2005, 02:03 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
Okay then,
I am updating my Dmod Helpin' the Ol' duck Farmer, amd I managed to get the giant pillbug in the end spawn smaller pillbugs when hit. There is however one problem. I'll post the hit() void here:

void hit( void )
{
sp_target(&current_sprite, &enemy_sprite);
playsound(30, 12000, 4000, &current_sprite, 0);
//lock on to the guy who just hit us
//playsound

//Spawn small "level 2" pillbugs! v1.1 addition.
if (random(3,1) == 1)
{
&save_x = sp_x(&current_sprite, -1);
&save_y = sp_y(&current_sprite, -1);
int &newpill = create_sprite(&save_x, &save_y, 9, 131, 1);
sp_speed(&newpill, 2);
sp_script(&newpill, "pill2");
}
}

No matter how fast I set sp_speed(), the newly created pillbugs always move VERY fast, almost as fast as Dink himself. Why does this happen and how can I solve it?

PS: "pill2" is a new .c script I created which contains data for a harder pillbug.
May 30th 2005, 02:08 PM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
Probably because the sp_speed command in the pill2 script overwrites the value of your first sp_speed command and the value of the sp_speed command in pill2 happens to a fast speed.
May 30th 2005, 02:09 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
But I use pill2 for many more enemies in that dmod and they all move much slower! That sp_speed is only 2...
May 30th 2005, 02:19 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
sp_timing(&newpill, ###)... I don't know how it works, but you better set it to 33 or 66 or something. Experiment a bit. Put it before the sp_script();

That, or else I don't know what to do either.
May 30th 2005, 02:22 PM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
That would explain why other pillbugs don't have it as sprites that you create in the editor have a timing of 33 by default and 66 when you set a sprite's brain to 9. That's the case in DinkEdit at least. In case of a created_sprite, it would be 0.