• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Drawing background tiles to a surface?

kamiyasi

Member
Hi. In my game I have background tiles that I use for walls. They look like this.
upload_2017-8-25_11-58-45.png

I also have a surface that draws shadows for objects such as the player, enemies, and props. What I would like to do is to also draw shadows for walls to this surface.
The way I think I would like to do this is with a script that finds every tile as a specific depth, and draws it offset up a bit and colored black to my surface. Is there a way I can do this? Thanks.
 

kamiyasi

Member
I've got it working pretty well like so
upload_2017-8-25_12-19-18.png
Code:
//draw shadow tiles
tile_array = tile_get_ids_at_depth(199);
for (var tt = 0; tt < array_length_1d(tile_array); tt++;)
{
    var tilett = tile_array[tt];
    d3d_end();
    draw_background_part_ext(tile_get_background(tilett), tile_get_left(tilett), tile_get_top(tilett), tile_get_width(tilett), tile_get_height(tilett), tile_get_x(tilett)-view_xview[0]-32, tile_get_y(tilett)-view_yview[0]-96,1,1,c_black,1);
}
Is there a more efficient way than to find and draw each tile separately every step like this?
 

Attachments

Top