Reply to Re: scripting help needed
If you don't have an account, just leave the password field blank.
Ah, I see. What you might want to do is something like:
int &starting_x = sp_x(¤t_sprite, -1);
int &starting_y = sp_y(¤t_sprite, -1);
int &my_x;
int &my_y;
loophere:
int &my_x = sp_x(¤t_sprite, -1);
int &my_y = sp_y(¤t_sprite, -1);
if (&my_x < &starting_x)
{
if (&my_y <= &starting_y)
{
sp_mx(¤t_sprite, 5)
sp_my(¤t_sprite, -10);
}
else
{
sp_mx(¤t_sprite, -10)
sp_my(¤t_sprite, -5);
}
}
else
{
if (&my_y <= &starting_y)
{
sp_mx(¤t_sprite, 10)
sp_my(¤t_sprite, 5);
}
else
{
sp_mx(¤t_sprite, -5);
sp_my(¤t_sprite, 10);
}
}
wait(50);
goto loophere;
Your script seems kind of weird. Keep in mind, when you compare my_x to x_max, you are comparing the x-coordinate of the sprite to the x-value 40, which is off the screen to the left.
int &starting_x = sp_x(¤t_sprite, -1);
int &starting_y = sp_y(¤t_sprite, -1);
int &my_x;
int &my_y;
loophere:
int &my_x = sp_x(¤t_sprite, -1);
int &my_y = sp_y(¤t_sprite, -1);
if (&my_x < &starting_x)
{
if (&my_y <= &starting_y)
{
sp_mx(¤t_sprite, 5)
sp_my(¤t_sprite, -10);
}
else
{
sp_mx(¤t_sprite, -10)
sp_my(¤t_sprite, -5);
}
}
else
{
if (&my_y <= &starting_y)
{
sp_mx(¤t_sprite, 10)
sp_my(¤t_sprite, 5);
}
else
{
sp_mx(¤t_sprite, -5);
sp_my(¤t_sprite, 10);
}
}
wait(50);
goto loophere;
Your script seems kind of weird. Keep in mind, when you compare my_x to x_max, you are comparing the x-coordinate of the sprite to the x-value 40, which is off the screen to the left.