growing sprites from small
I want to spawn a sprite from small (5%) , then grow it large. But it disapears when it reaches its size.
int &felmx = sp_x(&current_sprite,-1);
int &felmy = sp_y(&current_sprite,-1);
int &felm = create_sprite(&felmx,&felmy,6,971,1);
sp_size(&felm,5);
sp_brain_parm(&felm, 400);
sp_brain(&felm, 12);
wait(3000);
sp_brain(&felm,6);
sp_speed(&felm,1);
sp_target(&felm,1);
sp_base_walk(&felm,970);
int &felmx = sp_x(&current_sprite,-1);
int &felmy = sp_y(&current_sprite,-1);
int &felm = create_sprite(&felmx,&felmy,6,971,1);
sp_size(&felm,5);
sp_brain_parm(&felm, 400);
sp_brain(&felm, 12);
wait(3000);
sp_brain(&felm,6);
sp_speed(&felm,1);
sp_target(&felm,1);
sp_base_walk(&felm,970);
That's because the shrink/grow brain kills the sprite one it reaches the size you set it to.
If you want something to grow to a size and keep it that way, you have to "fake it", like this:
sp_size(&felm, 5);
wait(50);
sp_size(&felm, 20);
wait(50);
sp_size(&felm, 40);
wait(50);
sp_size(&felm, 60);
wait(50);
sp_size(&felm, 80);
wait(50);
... you get the idea. Tweak it for speed how smoothly you want it to grow.
If you want something to grow to a size and keep it that way, you have to "fake it", like this:
sp_size(&felm, 5);
wait(50);
sp_size(&felm, 20);
wait(50);
sp_size(&felm, 40);
wait(50);
sp_size(&felm, 60);
wait(50);
sp_size(&felm, 80);
wait(50);
... you get the idea. Tweak it for speed how smoothly you want it to grow.
Or to make it a bit smoother, use a loop like so:
int &felmx = sp_x(&current_sprite,-1);
int &felmy = sp_y(&current_sprite,-1);
int &fsize = 5;
int &felm = create_sprite(&felmx,&felmy,6,971,1);
sp_size(&felm,5);
sp_brain_parm(&felm, 400);
sp_brain(&felm, 12);
wait(3000);
sp_speed(&felm,1);
sp_target(&felm,1);
sp_base_walk(&felm,970);
loop:
&fsize += 1;
sp_size(&felm, &fsize);
wait(50); //adjest as needed
if (&fsize < 100)
goto loop;
Another posibiliy would be to use the shrink/grow brain but set it larger than you really want and stop it at 100, but that strikes me as likely to mess up unexpectedly.
int &felmx = sp_x(&current_sprite,-1);
int &felmy = sp_y(&current_sprite,-1);
int &fsize = 5;
int &felm = create_sprite(&felmx,&felmy,6,971,1);
sp_size(&felm,5);
sp_brain_parm(&felm, 400);
sp_brain(&felm, 12);
wait(3000);
sp_speed(&felm,1);
sp_target(&felm,1);
sp_base_walk(&felm,970);
loop:
&fsize += 1;
sp_size(&felm, &fsize);
wait(50); //adjest as needed
if (&fsize < 100)
goto loop;
Another posibiliy would be to use the shrink/grow brain but set it larger than you really want and stop it at 100, but that strikes me as likely to mess up unexpectedly.
Thanx guys. I have been useing loops with += to do this in the past, but it didn't work right this time. I thought the brain_parm might be cleaner. But now I changed the name of &felm , looped it to grow and it's working.o.k.
You could set the brain parm higher, and then have something check it constantly, and when it reaches size 400, change it's brain to normal.