MV Centering Social Media Buttons (Fixed)

My friend coded some social media buttons as a plugin for our new in development game.

He is having difficulty getting the social media buttons to align in the middle bottom of the screen.

Can you offer javascript coding ideas on ways to align the buttons to the middle of the screen?

He said "The usual formula Graphics.width / 2 - total buttons width doesn't work efficaciously."

and Center Sprite only works for a single image.

What he currently has in effect is "graphics width (816) 24 * number of social media buttons".

Are there any good solutions to such a problem?

Thank you friends.
Let's say you want a "button area" of width w centred horizontally on the game canvas. Its x position (left edge) will be at:

x₀ = (Graphics.boxWidth - w) / 2
I.e.
  • Graphics.boxWidth / 2 - horizontal centre;
  • - w / 2 - minus half the button area width.
Note: I've used .boxWidth (game display area) here rather than .width (game screen). By default I think these are equal, but you might have a reason to prefer one over the other.

For the individual button positions, let's number them starting from n = 1 and define:
  • Button width: b for all buttons
  • Spacing between buttons: s
Then the nth button's x position will be:

xₙ = x₀ + (b + s) * (n - 1)
I.e.
  • x₀ - button area x position;
  • + b * (n - 1) - plus the total width of all buttons before this one;
  • + s * (n - 1) - plus the total spacing for all buttons before this one.
Thank you very much :3

Let's say you want a "button area" of width w centred horizontally on the game canvas. Its x position (left edge) will be at:

x₀ = (Graphics.boxWidth - w) / 2

I.e.
  • Graphics.boxWidth / 2 - horizontal centre;
  • - w / 2 - minus half the button area width.
Note: I've used .boxWidth (game display area) here rather than .width (game screen). By default I think these are equal, but you might have a reason to prefer one over the other.

For the individual button positions, let's number them starting from n = 1 and define:
  • Button width: b for all buttons
  • Spacing between buttons: s
Then the nth button's x position will be:

xₙ = x₀ + (b + s) * (n - 1)

I.e.
  • x₀ - button area x position;
  • + b * (n - 1) - plus the total width of all buttons before this one;
  • + s * (n - 1) - plus the total spacing for all buttons before this one.

Original thread: https://forums.rpgmakerweb.com/threads/centering-social-media-buttons-fixed.145721/