S
sminc
Guest
Hey gang,
Longtime Game maker guy here, getting back into it and starting a serious project. I don't "fully" understand shaders and surfaces, and that's leading to a problem with "surface_get_pixel_ext".
Currently, I use this to (attempt) to find the alpha of the pixel at this point (where the player is):
However, it only jumps between 255 an 0 as the returned values-- nothing in between, even though I've drawn multiple gradients of circles on the surface. Below is what I typically use to draw said circles:
Am I missing something? Does this have to do with the fact that I'm using subtraction as the blend mode and removing from the black surface? Something to do with negative numbers? I've been struggling with this for months.
Thanks in advance,
sminc
Longtime Game maker guy here, getting back into it and starting a serious project. I don't "fully" understand shaders and surfaces, and that's leading to a problem with "surface_get_pixel_ext".
Currently, I use this to (attempt) to find the alpha of the pixel at this point (where the player is):
Code:
if surface_exists(light)
{
surfpix = surface_getpixel_ext(light,464,200);
myvisibility = (surfpix >> 24) & 225;
};
However, it only jumps between 255 an 0 as the returned values-- nothing in between, even though I've drawn multiple gradients of circles on the surface. Below is what I typically use to draw said circles:
Code:
if surface_exists(light)
{
var lightsize = 128;
var lightcolor = c_dkgray;
gpu_set_blendmode(bm_subtract);
surface_set_target(light);
draw_ellipse_colour(x-lightsize/2,y-11-lightsize/2,x+lightsize/2,y-11+lightsize/2,lightcolor,c_black,false);
surface_reset_target();
gpu_set_blendmode(bm_normal);
};
Thanks in advance,
sminc