Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Postmodern Adventures on Fri 07/08/2020 12:29:51

Title: World map buttons order
Post by: Postmodern Adventures on Fri 07/08/2020 12:29:51
Hi! I have a world map that looks like this:

(https://i.imgur.com/TlSNQmr.png)

The places to go are buttons. Is there any (easy if it's possible) way for them to appear listed as you discover them?
Title: Re: World map buttons order
Post by: Khris on Fri 07/08/2020 13:01:43
Use a variable:

Code (ags) Select
  bDiner.Y = mapYOffset; // position button
  bDiner.Visible = true;  // turn it visible
  mapYOffset += 15;  // increase y offset for next button
Title: Re: World map buttons order
Post by: Postmodern Adventures on Fri 07/08/2020 14:31:42
Thanks, Krhis. But i have not clear how to do it. After three games I'm still a little noob with code.

I have some buttons of places hidden at game_start. I defined a variable called mapYOffset in a global variables tab. And when a character say to the the player where to go i put your code:
Code (ags) Select

      btn_diner.Y = mapYOffset; // position button
      btn_diner.Visible = true;  // turn it visible
      mapYOffset += 15;  // increase y offset for next button


But the button doesn't appears. I guess i´m doing something wrong. But... what?
Sorry for bothering you for something so seemingly simple.
Title: Re: World map buttons order
Post by: Khris on Mon 10/08/2020 11:58:39
What's the initial value of mapYOffset? And what's the X coordinate of the button?
Also, double check that the function is called and that the code actually runs (use Display("showing diner button"); or something like that)
Title: Re: World map buttons order [SOLVED]
Post by: Postmodern Adventures on Mon 10/08/2020 14:00:41
The problem was the value of the mapYOffset variable wich now is the Y coordinate of the last button visible per default in the map of the game.
It works like a charm now. Thank you very much, Krhis!