Author Topic: How to set interact distance ?  (Read 92 times)

How to set interact distance ?
« on: 10 Jan 2018, 20:46 »
Hi everybody.

Im creating a game as a school assigment and i choose this program to be my engine.

But im having a problem now. I created a room in a painting software, and in AGS a made a hotspot over than door and i want the player to change the room when he interacts with the door.
Everything works only that the player can click on the door from any distance to change to room. I would like to know how to create a hotspot or a object and set a distance from which it can be interacted with.

Thanks

Re: How to set interact distance ?
« Reply #1 on: 11 Jan 2018, 09:32 »
Do you really only want the player to allow to interact with the door when they stand next to it or do you just want the character to walk to the door before opening it? If it's the latter then you can just set the WalkToPoint in the door hotspot's property pane. Alternatively you could code it yourself using a blocking walk command:

Code: Adventure Game Studio
  1. function hDoor_Interact()
  2. {
  3.   player.Walk(282, 173, eBlock); // or whatever the coordinates should be
  4.   player.ChangeRoom(6);
  5. }
« Last Edit: 11 Jan 2018, 09:36 by Matti »

Re: How to set interact distance ?
« Reply #2 on: 11 Jan 2018, 14:17 »
Do you really only want the player to allow to interact with the door when they stand next to it or do you just want the character to walk to the door before opening it? If it's the latter then you can just set the WalkToPoint in the door hotspot's property pane. Alternatively you could code it yourself using a blocking walk command:

Code: Adventure Game Studio
  1. function hDoor_Interact()
  2. {
  3.   player.Walk(282, 173, eBlock); // or whatever the coordinates should be
  4.   player.ChangeRoom(6);
  5. }

Thank you ! This was exactly what i was looking for.