Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

[gm]glow


ZFG

Recommended Posts

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 : alpha_mask.png

sGlowColor : color_sprite.png

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

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

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...