Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sun 22/10/2006 08:32:58

Title: How can I implement orthogonal movement?
Post by: on Sun 22/10/2006 08:32:58
All the movement controls in AGS seem to be based on moving to an X,Y location. How can I simply make the character move in an orthogonal direction (up, down, left, right) without requiring a destination point?
Title: Re: How can I implement orthogonal movement?
Post by: SSH on Sun 22/10/2006 09:06:37
down in X, Y+1; up is X, Y-1; left is X-1, Y and right is X+1, Y. Easy peasy
Title: Re: How can I implement orthogonal movement?
Post by: on Sun 22/10/2006 09:28:39
Brilliant. I went ahead and make an onKeyPress handler for the 4 arrow keys that simply adds or subtracts 1 to character.x or character.y as appropriate. I should've thought of that sooner. Thank you very much!  :D
Title: Re: How can I implement orthogonal movement?
Post by: Ashen on Sun 22/10/2006 11:41:15
There're also a couple of keyboard movement modules available (e.g. HERE (http://americangirlscouts.org/bbc.com/yabb/index.php?topic=21766.0) and HERE (http://americangirlscouts.org/bbc.com/yabb/index.php?topic=22724.0)). Not sure how much use they'll be if you've got it sorted yourself but you might get some ideas from the code, if you run into any further problems.
Title: Re: How can I implement orthogonal movement?
Post by: on Sun 22/10/2006 21:33:48
I guess I should add as a follow-up question: How do I set the keys that clear message boxes? As it is, messages are getting cleared by the arrow keys while moving the player around, which means the player will miss any messages that pop up while moving around; messages should only clear on ENTER and ESC keys. Is there some way to set this?