scr_toolset.gml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // Les actifs du script ont changé pour v2.3.0 Voir
  2. // https://help.yoyogames.com/hc/en-us/articles/360005277377 pour plus d’informations
  3. // @function array_loop();
  4. /// @param {Array} _arr The array to move into
  5. /// @param {real} _curr Where to start from
  6. /// @param {real} _add Moving in the table by how many (pos. or neg.)
  7. /// @description Return the new integer table position
  8. function array_loop(_arr, _curr, _add){
  9. _curr += _add
  10. if (_curr >= array_length(_arr))
  11. {
  12. _curr = 0;
  13. }
  14. if (_curr < 0)
  15. {
  16. _curr = array_length(_arr) - 1;
  17. }
  18. return _curr
  19. }
  20. // @function get_selec_card();
  21. /// @param {Array} _hand The array to search for
  22. /// @description Return the array position of the selected card
  23. function get_selec_card(_hand){
  24. for(i=0; i<=array_length(_hand); i+=1;)
  25. {
  26. if (variable_instance_exists(_hand[i], "selected"))
  27. {
  28. if (_hand[i].selected == true)
  29. {
  30. return i
  31. }
  32. }
  33. else
  34. {
  35. return -1
  36. }
  37. }
  38. }
  39. // @function progressbar();
  40. /// @param {real} _curr Current value
  41. /// @param {real} _max Max value
  42. /// @param {real} _width Max width (in pixels) of bar
  43. /// @description Draw current width of a progress bar
  44. function progressbar(_curr, _max, _width){
  45. return (_width / _max) * _curr
  46. }
  47. // @function draw_rect();
  48. /// @param {real} _x x pos
  49. /// @param {real} _y y pos
  50. /// @param {real} _width rect width
  51. /// @param {real} _height rect height
  52. /// @param {bool} _outline With outline?
  53. /// @description Draw a rectangle from width and height
  54. function draw_rect(_x, _y, _width, _height, _outline){
  55. var _x2 = (_x + _width);
  56. var _y2 = (_y + _height);
  57. draw_rectangle(_x, _y, _x2, _y2, _outline);
  58. }
  59. // @function draw_rect_inset();
  60. /// @param {real} _x x pos
  61. /// @param {real} _y y pos
  62. /// @param {real} _width rect width
  63. /// @param {real} _height rect height
  64. /// @param {real} _inset how much of inset
  65. /// @description Draw a rectangle from width and height (and opt. inset)
  66. function draw_rect_inset(_x, _y, _width, _height, _inset = 0){
  67. var _x1 = _x + _inset;
  68. var _x2 = (_x + _width) - _inset;
  69. var _y1 = _y + _inset;
  70. var _y2 = (_y + _height) - _inset;
  71. draw_rectangle(_x1, _y1, _x2, _y2, false);
  72. }
  73. // @function stats_traverse();
  74. /// @param {Array} _stats_map Current value
  75. /// @description Draw current width of a progress bar
  76. function stats_traverse(_stats_map){
  77. // TODO
  78. var _dmg_total = 0;
  79. return _dmg_total
  80. }