Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Gepard on Thu 03/12/2009 11:11:41

Title: diference between positions of characters
Post by: Gepard on Thu 03/12/2009 11:11:41
Is there a way I can find out the difference between the position.x of player character and some other character and possibly store this result as an int?

Thanks!
Title: Re: diference between positions of characters
Post by: Khris on Thu 03/12/2009 11:40:35
int x_diff = player.x - cOtherguy.x;

If the result needs to be positive, add

if (x_diff < 0) x_diff = -x_diff;