You are not logged in.
Pages: 1
/*
** Usage:
** draw_background_tiled_partial_ext(background,x,y,xscale,yscale,rot,color,alpha,index)
**
** Arguments:
** back the background to be drawn.
** x the x position of the background.
** y the y position of the background.
** xscale the hor. scale of the background.
** yscale the ver. scale of the background.
** rot the angle of the background.
** color the color of the background.
** alpha the alpha transparency of the background.
** index to check if the background is tiled vertically.
**
** Notes:
** Don't change the value of the 'top' variable. That will make the background get drawn as many pixels the background has below the top background.
**
** Returns:
** Returns a drawn background depending if it's tiled horizontally i/o vertically.
**
** Example:
** draw_background_tiled_partial_ext(background_index[0],view_xview[0]/2,0,1,1,0,background_blend[0],background_alpha[0]);
**
** GMLscripts.com
*/
var back, width, height, xx, yy, left, right, bottom, index, i, j;
back = argument0;
xx = argument1;
yy = argument2;
xscale = argument3;
yscale = argument4;
rot = argument5;
color = argument6;
a_trans = argument7;
index = argument8;
width = background_get_width(back);
height = background_get_height(back);
left = -1;
right = view_xview[view_current]/width+view_wview[view_current]/width+1;
top = 1;
bottom = view_yview[view_current]/height+view_hview[view_current]/height+1;
if (view_enabled) {
if (background_vtiled[index] == false) {
for (i=left; i<right; i+=1) {
draw_background_ext(back,xx mod width+width*i,yy,xscale, yscale, rot, color, a_trans);
}
}
else {
for (i=left; i<right; i+=1) {
draw_background_ext(back,xx mod width+width*i,yy,xscale, yscale, rot, color, a_trans);
}
for (i=left; i<right; i+=1)
for (j=top; j<bottom; j+=1) {
draw_background_ext(back,xx mod width+width*i,yy mod height+height*j,xscale, yscale, rot, color, a_trans);
}
}
}
else {
if (background_vtiled[index] == false) {
for (i=-1; i<right; i+=1) {
draw_background_ext(back,xx mod width+width*i,yy,xscale, yscale, rot, color, a_trans);
}
}
else {
for (i=-1; i<right; i+=1) {
draw_background_ext(back,xx mod width+width*i,yy,xscale, yscale, rot, color, a_trans);
}
for (i=-1; i<right; i+=1)
for (j=1; j<bottom; j+=1) {
draw_background_ext(back,xx mod width+width*i,yy mod height+height*j,xscale, yscale, rot, color, a_trans);
}
}
}
If anyone has trouble with this script, let me know.
Last edited by CatezeeY (2014-05-28 01:23:29)
Offline
Can you provide a description of what this does and perhaps an example how one would use it?
Abusing forum power since 1986.
Offline
Can you provide a description of what this does and perhaps an example how one would use it?
Added a few things on the description of the script.
Offline
Pages: 1