I've been trying for a while now to make a script to make the character face the mouse loacation, using an 8 way character. Ive done the incredibly easy part but of course this means that he will always face up and down, unless you are on the exact y location of the player, this is also useless for an 8 way character, how can i get it to work with relatively straight lines, or at least so that within certain blocks of say 50 by 50 the player can face so it is a square edged triangle for the mouse to go in, however little that makes sense :o
So far this is just the simple bit I have:
if (mouse.x > player.x) player.FaceLocation(cCharacter.x + 50,cCharacter.y);
if (mouse.x < player.x) player.FaceLocation(cCharacter.x - 50,cCharacter.y);
if (mouse.y > player.y) player.FaceLocation(cCharacter.x,cCharacter.y + 50);
if (mouse.y < player.y) player.FaceLocation(cCharacter.x,cCharacter.y - 50);
If anyone can understand my bad explanation help would be greatly appreciated
So far this is just the simple bit I have:
if (mouse.x > player.x) player.FaceLocation(cCharacter.x + 50,cCharacter.y);
if (mouse.x < player.x) player.FaceLocation(cCharacter.x - 50,cCharacter.y);
if (mouse.y > player.y) player.FaceLocation(cCharacter.x,cCharacter.y + 50);
if (mouse.y < player.y) player.FaceLocation(cCharacter.x,cCharacter.y - 50);
If anyone can understand my bad explanation help would be greatly appreciated