Niften
Member
Hi,
I think I have everything set up right but the backgrounds don't tile infinitely.
I think I have everything set up right but the backgrounds don't tile infinitely.
Code:
/***************************************************
Usage : draw_background_tiled_horizontal(back,x,y)
Arguments : argument0 == background
argument1 == x
argument2 == y
argument3 == alpha
argument4 == blend
Event : draw event
***************************************************/
///@param bg
///@param x
///@param y
///@param alpha
///@param blend
var back,width,xx,yy,left,right,i;
back=argument0;
width=sprite_get_width(back);
xx=argument1;
yy=argument2;
alpha=argument3;
left=-1;
right=__view_get( e__VW.XView, view_current )/width+__view_get( e__VW.WView, view_current )/width+1;
if (view_enabled)
{
for (i=left; i<right; i+=1)
{
//draw_background(back,xx mod width+width*i,yy);
draw_sprite_ext(back,0,xx mod width+width*i,yy,1,1,0,argument4,alpha);
};
}
else
{
for (i=-1; i<room_width/width+1; i+=1)
{
//draw_background(back,xx mod width+width*i,yy);
draw_sprite_ext(back,0,xx mod width+width*i,yy,1,1,0,argument4,alpha);
};
};
Code:
draw_background_tiled_horizontal(spr_clouds,obj_camera.x/1.1+xoff,obj_camera.y-50,1,noone);
draw_background_tiled_horizontal(spr_hills,obj_camera.x/1.12+200,obj_camera.y-50,1,make_color_rgb(191,191,191));
draw_background_tiled_horizontal(spr_hills,obj_camera.x/1.2,obj_camera.y-50,1,noone);
draw_background_tiled_horizontal(spr_tree_silhouette,obj_camera.x/1.3+200,obj_camera.y-50,1,make_color_rgb(191,191,191));
draw_background_tiled_horizontal(spr_tree_bg,obj_camera.x/1.35,obj_camera.y-50,1,noone);
draw_background_tiled_horizontal(spr_tree_bg2,obj_camera.x/1.4+300,obj_camera.y-50,1,noone);