The Dink Network

Reply to Re: X y movement commands

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
May 31st 2012, 05:04 PM
dinkdead.gif
"I would suggest creating a sprite at those coordinates and using sp_follow(&boss, &sprite);"

A probably better* way is just to move him in the right direction depending on where he is on the screen:

int &x = sp_x(&boss, -1);
int &y = sp_y(&boss, -1);

//might need adjusting if you need him to path around objects:

if (&x < 315)
{
 move_stop(&boss, 6, 315, 1);
}
else
{
 move_stop(&boss, 4, 315, 1);
}

if (&y < 100)
{
 move_stop(&boss, 2, 100, 1);
}
else
{
 move_stop(&boss, 8, 100, 1);
}

//and then if you need it to be exact:
sp_x(&boss, 315);
sp_y(&boss, 100);


Edit: *By better, I mean more accurate. Pillbug's way might look nicer