GameMaker [SOLVED] change color of tiles like tile_set_blend()

G

Guest User

Guest
in my project i have a piece of code that relys on obsolete compat functions when imported into GMS2
Code:
var tile = tile_layer_find(1000000, x, y);
if(tile != -1 && tile_get_blend(tile) != -1) {
    tile_set_blend(tile, blood_type); }
this is called when a creature is bleeding, and all it is supposed to do is "stain" the tile with whatever color the blood is.

would a surface be more ideal for this sort of thing instead? or is there a way to do this with the new asset layer (since tiles don't seem to be blend-able anymore) that doesn't involve looping through every single asset on a layer and comparing x/y coords to find the one i'm looking for? or some other method i'm not thinking about.
 
G

Guest User

Guest
soooo i got a surface up and running and everything works but...
TEMPO_SPLATTER: Create Event (adds the splatter color to surface)
Code:
/// @description Create Splatter
draw_set_color(blood_color);
surface_set_target(sys_controller.surface_layer_blood);
    draw_rectangle(x, y, x + step.hstep - 1, y + step.vstep - 1, false);
surface_reset_target();
draw_set_color(c_white);

instance_destroy();
SYS_CONTROLLER: Draw Event (draw the surface with blending)
Code:
// LAYER: Splatter
if(!surface_exists(surface_layer_blood)) {
    surface_layer_blood = surface_create(room_width, room_height);
    surface_set_target(surface_layer_blood);
        draw_clear_alpha(c_white, 1);
    surface_reset_target(); }
else {
    var view_x = camera_get_view_x(view_camera[0]); var view_y = camera_get_view_y(view_camera[0]);
    gpu_set_blendmode_ext(bm_zero, bm_src_color);
        draw_surface_part(surface_layer_blood, view_x, view_y, 340, 180, view_x, view_y);
    gpu_set_blendmode(bm_normal); }
this method doesn't really just change the tile color either, so certain blood colors mixed with certain tile colors just leave black tiles...which isn't particularly nice looking. if they change the color at all.
truthfully, i'd gather that this probably also happened using tile_set_blend() in GMS1.4 and i just never noticed since i didn't have non-grey tiles at the time, but that doesn't really help me out here now. :(

anyone happen to have an idea of how i can solve my problem?
 
Top