Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Stompybot on Thu 24/04/2008 21:37:41

Title: Hotspot interaction problem (Solved) :)
Post by: Stompybot on Thu 24/04/2008 21:37:41
I have started making a game and I have made it so that when someone interacts with a certain hotspot then they will obtain an item. However I want to make it so that the hotspot interacts differently when they click on it for a second time. Anyone know how ???
Title: Re: Hotspot interaction problem
Post by: Matti on Fri 25/04/2008 13:25:32
You have to create a variable that checks if the hotspot was clicked a second time.

It should look something like that:


int click=0;

interact_hotspotxy(){

  if (click==0) {  //first time hotspot is clicked
    ...
  }
  if (click==1) {  //second and any further time hotspot is clicked
    ...
  }

if (click==0) {
  click++;
}

}
Title: Re: Hotspot interaction problem
Post by: Khris on Fri 25/04/2008 13:54:14
Or:
...
  if (click==0) {
    ...
    click=1;
  }
  else {
    ...
  }
...


And since 3.0.1 I think, there's Game.DoOnceOnly (http://www.adventuregamestudio.co.uk/manual/Game.DoOnceOnly.htm).

(btw, this is probably the single most often posted question ever and the most common beginner's problem. Realizing that and doing a forum search first shouldn't be that far-fetched. This forum's first page contains at least one thread dealing with this problem.)
Title: Re: Hotspot interaction problem
Post by: Stompybot on Fri 25/04/2008 16:42:32
Quote from: matti on Fri 25/04/2008 13:25:32
You have to create a variable that checks if the hotspot was clicked a second time.

It should look something like that:


int click=0;

interact_hotspotxy(){

  if (click==0) {  //first time hotspot is clicked


    ...
  }
  if (click==1) {  //second and any further time hotspot is clicked
    ...
  }

if (click==0) {
  click++;
}

}

Thanks my problem is solved now
Title: Re: Hotspot interaction problem
Post by: Stompybot on Fri 25/04/2008 16:44:25
Quote from: KhrisMUC on Fri 25/04/2008 13:54:14
Or:
...
  if (click==0) {
    ...
    click=1;
  }
  else {
    ...
  }
...


And since 3.0.1 I think, there's Game.DoOnceOnly (http://www.adventuregamestudio.co.uk/manual/Game.DoOnceOnly.htm).

(btw, this is probably the single most often posted question ever and the most common beginner's problem. Realizing that and doing a forum search first shouldn't be that far-fetched. This forum's first page contains at least one thread dealing with this problem.)
Sorry didn't know there was a forum search. Thanks
Title: Re: Hotspot interaction problem (Solved) :)
Post by: Khris on Fri 25/04/2008 16:49:06
There's also a Reply and a Modify button... :)