| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- // 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 The current variable
- /// @param {real} _add Moving how many
- /// @description Move and loop into the different variables of an array
- 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 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);
- }
|