Advertisement
Archeia

Put Sprite Battlers on Bottom

May 19th, 2024
624
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Declare Constants
  2. const sprite = this;
  3. const actor = this._actor;
  4. const index = arguments[0];
  5.  
  6. // Make Calculations
  7. const battlerSpacing = 200; // Increase this value to add more space between battlers
  8. let x = Math.round((Graphics.width / 2) - ($gameParty.maxBattleMembers() * battlerSpacing / 2) + (index * battlerSpacing));
  9. x -= Math.floor((Graphics.width - Graphics.boxWidth) / 2);
  10.  
  11. let y = Graphics.height - 150;
  12. y -= Math.floor((Graphics.height - Graphics.boxHeight) / 2);
  13.  
  14. // Home Position Offsets
  15. const offsetNote = /<SIDEVIEW HOME OFFSET:[ ]([\+\-]\d+),[ ]([\+\-]\d+)>/i;
  16. const xOffsets = actor.traitObjects().map((obj) => (obj && obj.note.match(offsetNote) ? Number(RegExp.$1) : 0));
  17. const yOffsets = actor.traitObjects().map((obj) => (obj && obj.note.match(offsetNote) ? Number(RegExp.$2) : 0));
  18. x = xOffsets.reduce((r, offset) => r + offset, x);
  19. y = yOffsets.reduce((r, offset) => r + offset, y);
  20.  
  21. // Set Home Position
  22. this.setHome(x, y);
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement