Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Construed on Sun 29/12/2013 21:02:04

Title: WalkTo Interactions(solved)
Post by: Construed on Sun 29/12/2013 21:02:04
Does anyone know if there is a way to use the WalkTo function for all interactions gamewide with the EmodeWait feature?
Title: Re: WalkTo Interactions
Post by: Dualnames on Sun 29/12/2013 21:06:56
You mean be able to walk to objects and characters the same way you walk to hotspots?
Title: Re: WalkTo Interactions
Post by: Construed on Sun 29/12/2013 21:12:04
Yes, It seems unrealistic to click things and have a reaction from across the screen, yet there must be a better way that doing walktox,y a thousand times?
Title: Re: WalkTo Interactions
Post by: Khris on Sun 29/12/2013 22:21:10
You can calculate an appropriate position. Pretty straightforward for characters, and for objects the center is at x = object.X + Game.SpriteWidth[object.Graphic] / 2;

Now you have the position of the object / character. The next step is to find a suitable location near them with a reachable walkable area. Or just make the game walk to x, y + 10, that's a pretty good rule of thumb. (Avoid this if the player character is clickable, I hate having to move out of the way to click an object after trying to do something to it.)

To actually implement this, use GetLocationType and the .GetAtScreenXY functions in on_mouse_click().
Title: Re: WalkTo Interactions
Post by: Construed on Sun 29/12/2013 22:39:15
Thanks :) Works good.