Moving character based on current position. (SOLVED)

Started by Amayirot Akago, Thu 09/06/2016 08:44:05

Previous topic - Next topic

Amayirot Akago

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
  cPostman.Walk(cPostman.x, 190, eBlock);


That's all I had to do.
Quote from: CaptainDMy suspicion is that an accident, probably caused by a lightning storm and a mad professor, resulted in Amayirot's brain becoming inextricably linked to the databases behind MobyGames and LemonAmiga.

Danvzare

You can also use something like this:
Code: ags
  cPostman.Walk(cPostman.x, cPostman.y-10, eBlock);

To further generalize it. :-D

Amayirot Akago

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!
Quote from: CaptainDMy suspicion is that an accident, probably caused by a lightning storm and a mad professor, resulted in Amayirot's brain becoming inextricably linked to the databases behind MobyGames and LemonAmiga.

SMF spam blocked by CleanTalk