Deltarune script viewer

← back to main script listing

gml_GlobalScript_draw_sprite_part_parallax_scale

(view raw script w/o annotations or w/e)
1
function draw_sprite_part_parallax_scale(arg0, arg1, arg2, arg3, arg4, arg5)
2
{
3
    var _scale = arg5;
4
    var _mysprite = arg0;
5
    var _mywidth = sprite_get_width(arg0);
6
    var _myheight = sprite_get_height(arg0);
7
    var _xoffset = arg2 % _mywidth;
8
    var _yoffset = arg3 % _myheight;
9
    if (_xoffset < 0)
10
        _xoffset += _mywidth;
11
    if (_yoffset < 0)
12
        _yoffset += _myheight;
13
    var _xmax = _mywidth * (2 / _scale);
14
    var _ymax = _myheight * (2 / _scale);
15
    if (_xoffset == 0 && _yoffset == 0)
16
    {
17
        draw_sprite_ext(arg0, arg1, x, y, 2, 2, 0, image_blend, arg4);
18
    }
19
    else
20
    {
21
        draw_sprite_part_ext(arg0, arg1, 0, 0, _xmax - _xoffset, _ymax - _yoffset, x + (_xoffset * _scale), y + (_yoffset * _scale), _scale, _scale, image_blend, arg4);
22
        draw_sprite_part_ext(arg0, arg1, _mywidth - _xoffset, _myheight - _yoffset, min(_xmax, _xoffset), min(_ymax, _yoffset), x, y, _scale, _scale, image_blend, arg4);
23
        draw_sprite_part_ext(arg0, arg1, 0, _ymax - _yoffset, min(_xmax, _xmax - _xoffset), min(_ymax, _yoffset), x + (_xoffset * _scale), y, _scale, _scale, image_blend, arg4);
24
        draw_sprite_part_ext(arg0, arg1, _xmax - _xoffset, 0, min(_xmax, _xoffset), min(_ymax, _ymax - _yoffset), x, y + (_yoffset * _scale), _scale, _scale, image_blend, arg4);
25
    }
26
}