Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// @func draw_sprite_tiled_area
- /// @arg {sprite} sprite
- /// @arg {real} subimg
- /// @arg {real} x1
- /// @arg {real} y2
- /// @arg {real} x2
- /// @arg {real} y2
- /// @arg {color*} col
- /// @arg {real*} alpha
- /// @desc Fills a rectangular area with the given sprite, tiled.
- var _sprite = argument[0],
- _subimg = argument[1],
- _x1 = argument[2],
- _y1 = argument[3],
- _x2 = argument[4],
- _y2 = argument[5],
- _col = c_white,
- _alpha = 1;
- if (argument_count > 6){
- _col = argument[6];
- }
- if (argument_count > 7){
- _alpha = argument[7];
- }
- var _sprW = sprite_get_width(_sprite);
- var _sprH = sprite_get_height(_sprite);
- for (var _y = _y1; _y < _y2; _y += _sprH){
- for (var _x = _x1; _x < _x2; _x += _sprW){
- var _w = min(_sprW, _x2 - _x);
- var _h = min(_sprH, _y2 - _y);
- draw_sprite_part_ext(_sprite,_subimg,0,0,_w,_h,_x,_y,1,1,_col,_alpha);
- }
- }
Add Comment
Please, Sign In to add comment