Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: highkingtorygg on Mon 27/07/2015 19:55:57

Title: How do I trigger an event by the player standing somewhere?
Post by: highkingtorygg on Mon 27/07/2015 19:55:57
So far I'm just using if statements to have them able to pick up the thing. The bad part about that is that i'm a very basic programmer and can only trigger the events on a certain pixel.
Title: Re: How do I trigger an event by the player standing somewhere?
Post by: Slasher on Mon 27/07/2015 20:08:47
i assume you mean hard to click on object/hotspot....

could be:
if the hotspot for a mouse cursor is not set in the best place it can be awkward to click on things. The hand interact hotspot should ideally be on the end of the middle finger for example, or in the center of the eye of look cursor.

check mouse cursor modes and their graphic hotspot x y.

Or do you mean from a region? you can use if functions like hotspots as well. like if player walks on...


Title: Re: How do I trigger an event by the player standing somewhere?
Post by: highkingtorygg on Mon 27/07/2015 20:24:47
I totally forgot regions existed. Thanks
Title: Re: How do I trigger an event by the player standing somewhere?
Post by: Dualnames on Fri 31/07/2015 08:55:25
Also a silly way to solve this is by doing the most common checks. Rectangle checks.

So you can do this, not very advised when regions exist, but here it is anyway.
Code (ags) Select

function repeatedly_execute()
{
  //this will constantly run a check on a 40x20 rectangle area.
  if (cEgo.x >= 50 && cEgo.x <= 90 && cEgo.y >= 100 && cEgo.y <= 120)
  {
    //do ur thing
  }
}