// Les actifs du script ont changé pour v2.3.0 Voir // https://help.yoyogames.com/hc/en-us/articles/360005277377 pour plus d’informations // @function array_loop(); /// @param {Array} _arr The array to move into /// @param {real} _curr Where to start from /// @param {real} _add Moving in the table by how many (pos. or neg.) /// @description Return the new integer table position function array_loop(_arr, _curr, _add){ _curr += _add if (_curr >= array_length(_arr)) { _curr = 0; } if (_curr < 0) { _curr = array_length(_arr) - 1; } return _curr } // @function get_selec_card(); /// @param {Array} _hand The array to search for /// @description Return the array position of the selected card function get_selec_card(_hand){ for(i=0; i<=array_length(_hand); i+=1;) { if (variable_instance_exists(_hand[i], "selected")) { if (_hand[i].selected == true) { return i } } else { return -1 } } } // @function progressbar(); /// @param {real} _curr Current value /// @param {real} _max Max value /// @param {real} _width Max width (in pixels) of bar /// @description Draw current width of a progress bar function progressbar(_curr, _max, _width){ return (_width / _max) * _curr } // @function draw_rect(); /// @param {real} _x x pos /// @param {real} _y y pos /// @param {real} _width rect width /// @param {real} _height rect height /// @param {boolean} _outline With outline? /// @description Draw a rectangle from width and height function draw_rect(_x, _y, _width, _height, _outline){ var _x2 = (_x + _width); var _y2 = (_y + _height); draw_rectangle(_x, _y, _x2, _y2, _outline); } // @function draw_rect_inset(); /// @param {real} _x x pos /// @param {real} _y y pos /// @param {real} _width rect width /// @param {real} _height rect height /// @param {real} _inset how much of inset /// @description Draw a rectangle from width and height (and opt. inset) function draw_rect_inset(_x, _y, _width, _height, _inset = 0){ var _x1 = _x + _inset; var _x2 = (_x + _width) - _inset; var _y1 = _y + _inset; var _y2 = (_y + _height) - _inset; draw_rectangle(_x1, _y1, _x2, _y2, false); }