Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Amayirot Akago on Thu 09/06/2016 08:44:05

Title: Moving character based on current position. (SOLVED)
Post by: Amayirot Akago on Thu 09/06/2016 08:44:05
When my character walks off the lower edge of the room, I want him display a message saying he can't go that way and then walk back up a couple of pixels to avoid continually hitting the edge again, while his x coordinate remains the same. How exactly would I do this? The regular Walk function only lets me walk to specific coordinates in the room (as far as I understand it), and changing the y property pretty much just teleports him.

EDIT: Disregard this, I am a moron.
Code (ags) Select
  cPostman.Walk(cPostman.x, 190, eBlock);

That's all I had to do.
Title: Re: Moving character based on current position. (SOLVED)
Post by: Danvzare on Thu 09/06/2016 11:20:45
You can also use something like this:
Code (ags) Select
  cPostman.Walk(cPostman.x, cPostman.y-10, eBlock);
To further generalize it. :-D
Title: Re: Moving character based on current position. (SOLVED)
Post by: Amayirot Akago on Thu 09/06/2016 14:50:56
Ah, that is more or less what I was trying to do :D Since the edge is always in a fixed spot I figured I could just use a fixed y coordinate as well. Thanks!