SRL Archive - OSR Help

Walking with arrow keys


xRyuhou

2012-07-07 00:56:43

So, I'm currently trying to create a auto fighter script for a game called Slayers Online (think LoZ: A Link to the Past for the SNES). It's a top down little game and it uses the arrow keys to move around. I was wondering if there was a way I could get my character to move to a monster. I know how to find a monster and it's coordinates, I just don't know how to get my character to move there.

Any tips would be appreciated. I can probably figure it out of pointed in the right direction.

Sir Ducksworthy

2012-07-07 01:02:54

What I would do is have the what ever keys held down to go in which ever direction until you are parallel to it and than keeping the forward button held down while monitoring how close you are to the monster then releasing the button when in a certain distance ;)

xRyuhou

2012-07-07 01:23:54

From: leetsxc
What I would do is have the what ever keys held down to go in which ever direction until you are parallel to it and than keeping the forward button held down while monitoring how close you are to the monster then releasing the button when in a certain distance ;)


Would I be able to monitor that through the coordinates? For example, if my character is at 334, 260 and the monster is at 386, 107, would I be able to do something like this (in pseudo-code (ish)):


if char x < monster x
KeyDown(VK_RIGHT)
else if
char x > monster x
KeyDown(VK_LEFT)

and so on for the y coordinate? I know this wouldn't be all there is to it, but if there's something similar to this that I could do, what would be the best function to use for it?

Thanks for the help, by the way. :)

xRyuhou

2012-07-07 13:38:56

Bump? I'm really stumped with this. :/