World map buttons order

Started by Postmodern Adventures, Fri 07/08/2020 12:29:51

Previous topic - Next topic
Hi! I have a world map that looks like this:



The places to go are buttons. Is there any (easy if it's possible) way for them to appear listed as you discover them?

Khris

Use a variable:

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

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

      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.

Khris

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)

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!

SMF spam blocked by CleanTalk