How can I implement orthogonal movement?

Started by , Sun 22/10/2006 08:32:58

Previous topic - Next topic

LateBlt

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?

SSH

down in X, Y+1; up is X, Y-1; left is X-1, Y and right is X+1, Y. Easy peasy
12

LateBlt

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

Ashen

There're also a couple of keyboard movement modules available (e.g. HERE and HERE). 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.
I know what you're thinking ... Don't think that.

LateBlt

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?

SMF spam blocked by CleanTalk