Reply to Re: scripting help needed
If you don't have an account, just leave the password field blank.
Hmm... I'm not exactly sure that would work, especially since if I recall correctly, sp_speed() and sp_dir() are independent of sp_mx() and sp_my(). Really, if you want make curving movement, you absolutely have to use sp_mx() and/or sp_my() in conjunction with quick-running loops that change those values for the object. I tried to explain it using crappy ASCII, but I guess I didn't do a very good job. Try looking scripts for other objects that have curving movements... I know Paul's Aether magic in Crosslink has it, and I'm pretty sure there's stuff in FIAT as well.
Anyway, this is how I would see it for an individual axe, starting directly from the left of Dink:
//Assumes the missile properties were established in the code that spawned it
//Also assumes that the axe will be spawned from the left of Dink
//More will have to be done if you want it to detect where the axe was spawned
void_main()
{
int &mx = sp_x(¤t_sprite, -1);
int &my = sp_y(¤t_sprite, -1);
//For this example, 5 and -5 will be our max and min values
int &x_counter = 0;
int &y_counter = -5;
//These are important for changing the directions of the axe.
int &x_dir = 1;
int &y_dir = -1;
//Value will be what will make the object spiral away.
int &wait_time = 10;
//This just counts how many times the loop has run, so we have a place to stop it all.
int total_loops = 0;
daloop:
//Object will travel in the following directions
sp_mx(¤t_sprite, &x_counter);
sp_my(¤t_sprite, &y_counter);
//Check if object has reached the bounds we have set for it
//If so, begin changing the direction
if(&x_counter >= 5)
&x_dir *= -1;
if(&x_counter <= -5)
&x_dir *= -1;
if(&y_counter >= 5)
&y_dir *= -1;
if(&y_counter <= -5)
&y_dir *= -1;
&x_counter += &x_dir;
&y_counter += &y_dir;
//There will be a slightly large amount of time between each loop.
wait(&wait_time);
&wait_time += 10;
&total_loops += 1;
if(&total_loops < 50)
goto daloop;
//Kill it all
sp_active(¤t_sprite, 0);
kill_this_task();
}
It should be noted that practically all the values in this script can be tweaked so that you can get the arcing effect you want.
Anyway, this is how I would see it for an individual axe, starting directly from the left of Dink:
//Assumes the missile properties were established in the code that spawned it
//Also assumes that the axe will be spawned from the left of Dink
//More will have to be done if you want it to detect where the axe was spawned
void_main()
{
int &mx = sp_x(¤t_sprite, -1);
int &my = sp_y(¤t_sprite, -1);
//For this example, 5 and -5 will be our max and min values
int &x_counter = 0;
int &y_counter = -5;
//These are important for changing the directions of the axe.
int &x_dir = 1;
int &y_dir = -1;
//Value will be what will make the object spiral away.
int &wait_time = 10;
//This just counts how many times the loop has run, so we have a place to stop it all.
int total_loops = 0;
daloop:
//Object will travel in the following directions
sp_mx(¤t_sprite, &x_counter);
sp_my(¤t_sprite, &y_counter);
//Check if object has reached the bounds we have set for it
//If so, begin changing the direction
if(&x_counter >= 5)
&x_dir *= -1;
if(&x_counter <= -5)
&x_dir *= -1;
if(&y_counter >= 5)
&y_dir *= -1;
if(&y_counter <= -5)
&y_dir *= -1;
&x_counter += &x_dir;
&y_counter += &y_dir;
//There will be a slightly large amount of time between each loop.
wait(&wait_time);
&wait_time += 10;
&total_loops += 1;
if(&total_loops < 50)
goto daloop;
//Kill it all
sp_active(¤t_sprite, 0);
kill_this_task();
}
It should be noted that practically all the values in this script can be tweaked so that you can get the arcing effect you want.