stickyfingers
Member
Hi everyone!
Trying to implement a tiled parallax background that only loads the specific tiles when needed and I can't figure out how to do this in a smart way using draw_background.
1. Is backgrounds drawn at a specific depth or is it infite? Can I draw a background behind an already existing one?
2. Is it better to draw_sprite and set the depth right there and then to match my specific layer in the background?
Right now the code looks like this (very tedious and repetative):
//Layer 4 tile1
draw_background(
bg4_01,
view_xview[view_current] * 0.65,
(view_yview[view_current] * 0.4) + yoffset
);
//tile2
draw_background(
bg4_02,
view_xview[view_current] * 0.65 + 1280,
(view_yview[view_current] * 0.4) + yoffset
);
//tile3
draw_background(
bg4_03,
view_xview[view_current] * 0.65 + 1280 + 1280,
(view_yview[view_current] * 0.4) + yoffset
);
//Layer 3 tile1
draw_background(
bg3_01,
view_xview[view_current] * 0.6,
(view_yview[view_current] * 0.3) + yoffset
);
//tile2
draw_background(
bg3_02,
view_xview[view_current] * 0.6 + 1280,
(view_yview[view_current] * 0.3) + yoffset
);
//tile3
draw_background(
bg3_03,
view_xview[view_current] * 0.6 + 1280 + 1280,
(view_yview[view_current] * 0.3) + yoffset
);
Trying to implement a tiled parallax background that only loads the specific tiles when needed and I can't figure out how to do this in a smart way using draw_background.
1. Is backgrounds drawn at a specific depth or is it infite? Can I draw a background behind an already existing one?
2. Is it better to draw_sprite and set the depth right there and then to match my specific layer in the background?
Right now the code looks like this (very tedious and repetative):
//Layer 4 tile1
draw_background(
bg4_01,
view_xview[view_current] * 0.65,
(view_yview[view_current] * 0.4) + yoffset
);
//tile2
draw_background(
bg4_02,
view_xview[view_current] * 0.65 + 1280,
(view_yview[view_current] * 0.4) + yoffset
);
//tile3
draw_background(
bg4_03,
view_xview[view_current] * 0.65 + 1280 + 1280,
(view_yview[view_current] * 0.4) + yoffset
);
//Layer 3 tile1
draw_background(
bg3_01,
view_xview[view_current] * 0.6,
(view_yview[view_current] * 0.3) + yoffset
);
//tile2
draw_background(
bg3_02,
view_xview[view_current] * 0.6 + 1280,
(view_yview[view_current] * 0.3) + yoffset
);
//tile3
draw_background(
bg3_03,
view_xview[view_current] * 0.6 + 1280 + 1280,
(view_yview[view_current] * 0.3) + yoffset
);