Prob creating sprite
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(¤t_sprite, &enemy_sprite);
playsound(30, 12000, 4000, ¤t_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(¤t_sprite, -1);
&save_y = sp_y(¤t_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.
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(¤t_sprite, &enemy_sprite);
playsound(30, 12000, 4000, ¤t_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(¤t_sprite, -1);
&save_y = sp_y(¤t_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.
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.
But I use pill2 for many more enemies in that dmod and they all move much slower! That sp_speed is only 2...
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.
That, or else I don't know what to do either.
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.