ZFG Posted April 5, 2008 Report Share Posted April 5, 2008 ok, Here we go, I have this sprite I want use this in my game, and I need help to make it glow. I have code: CODE: image_alpha = 0.5; but the white is still there. any help? Link to comment Share on other sites More sharing options...
Kain Posted April 5, 2008 Report Share Posted April 5, 2008 What you do is you create two sprites. One will be a black and white sprite that'll be used as an alpha mask. For each pixel in it, the more black it is, the more transparent it is. (technically, it doesn't have to be greyscale, but it's easier to see this way). The other sprite will be the color component. You probably want this to be all one color or some form of gradient (like a gradient between yellow and orange). Create these two sprites: sGlowAlpha : sGlowColor : Set sGlowColor as the sprite index of the object you want it to appear on and in its create event, perform the following code: sprite_set_alpha_from_sprite( sGlowColor, sGlowAlpha); You can also set the object's alpha lower and it'll work the way you imagine, but it's probably not needed since it's already partially see-through. Link to comment Share on other sites More sharing options...
USC Posted April 5, 2008 Report Share Posted April 5, 2008 Is there a way of changing the value of each pixel or every pixel of a certain color in GM? If so, just run a FOR loop / IF statement and set all the values of white to Alpha 0. Link to comment Share on other sites More sharing options...
Godmaster Posted April 5, 2008 Report Share Posted April 5, 2008 First of all, change the transparency color to black,maybe this can help you: draw_set_blend_mode (bm_max)//set blend to max draw_sprite(spr_glow,-1,x,y)//draw sprite draw_set_blend_mode (bm_normal)//return to normal blending to avoing blending the rest of the objects Link to comment Share on other sites More sharing options...
Khorney Posted April 5, 2008 Report Share Posted April 5, 2008 is GM capable of loading .tga's with alpha channels already in them and use the transparency? or do they have to be separate layers such as here? i don't really know much about the technical side, but i've noticed it doing texture work for mods and was wondering whether it can be applied to GM too Link to comment Share on other sites More sharing options...
Kain Posted April 5, 2008 Report Share Posted April 5, 2008 GM7 is capable of loading .png's with alpha channel already in them (GM6 isn't). But you have to load them externally through this function: sprite_add_alpha(fname,imgnumb,precise,preload,xorig,yorig) Adds the image stored in the file fname to the set of sprite resources, but this time the file has an alpha channel to indicate transparency (as for example in .png files). The arguments are the same as above (but two are missing as they are not relevant in this case). When an error occurs -1 is returned. But I don't know about .tga's. Based on the help file, I'm guessing it can (though it's not listed explicitly): What's new... When adding or replacing sprites and backgrounds or when using splash images, many different file formats can now be used, including jpg, tif, bmp, gif, png, etc. Link to comment Share on other sites More sharing options...
Recommended Posts