[SOLVED] A Dynamic Array to position characters one next to the other

Started by Baguettator, Mon 08/06/2020 22:09:20

Previous topic - Next topic

Matti

You could also switch to another background frame of the same room that also contains a background image for the characters.

Edit: I'm still sure if you want small backgrounds for each character or one background for all selected characters together.

Baguettator

OK thanks, I will try that :)

Another question : is it possible to have an array of buttons ?

Like : Button* buttonsofGUI1[nbbuttonsGUI1]

I want to make visible one button of a GUI and invisible the others. Maybe it is possible ?

Khris

Possible, but if you only put buttons on the GUI, you can use the GUI's  .Controls[]  array.

Baguettator

I only put buttons in that GUI. Just the button that has the ID "0" is a "OK" button to exit the GUI. I have 50 others buttons (ID 1 -> ID 50) between them I want to pick just one visible, the others invisible.

Is it something like :

Code: ags
Button* boutons = new Button[myGui.ControlCount];
  int nombreBoutons = 0;
  for (int n = 0; n < myGui.ControlCount; n++){
    GUIControl *control = myGui.Controls[n];
    if (control.AsButton != null) {
      boutons[nombreBoutons] = control.AsButton;
      nombreBoutons++;
    }
  }
boutonvisible=Random(nombreBoutons - 1) + 1 // to not choose the button with ID=0
boutons[boutonvisible].Visible=true;


And when I close the GUI, I can get all the buttons invisible again :

Code: ags
Button* boutons = new Button[myGui.ControlCount];
  int nombreBoutons = 0;
  for (int n = 0; n < myGui.ControlCount; n++){
    GUIControl *control = myGui.Controls[n];
    if (control.AsButton != null) {
      boutons[nombreBoutons] = control.AsButton;
      nombreBoutons++;
    }
  }
for (int m = 0; n < nombreBoutons ; m++)
{
boutons[m].Visible=false;
}


Am I right ?

SMF spam blocked by CleanTalk