A spróbuj tak
GML
if ( mouse_check_button(mb_left) && distance_to_object(obj_player) < 50 )
{
draw_set_color(box_colour)
d3d_draw_block(x-1,y-1.5,z,x+1,y+1.5,z_top,sprite_get_texture(sprite1,0),1,1)
mouse_colour = draw_getpixel(mouse_x,mouse_y)
if mouse_colour >= box_colour-10 && mouse_colour <= box_colour+10
{
show_message('Działa')
}
}
draw_set_color(c_white)
d3d_draw_block(x-1,y-1.5,z,x+1,y+1.5,z_top,sprite_get_texture(sprite,image),1,1)