GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2011-03-29 11:58:51

xot
Administrator
Registered: 2007-08-18
Posts: 1,201

sprite_set_alpha_from_sprite

A GMC member riddled me with questions about blend modes and the sprite_set_alpha_from_sprite function. Answering them involved a number of tests that clarified and confirmed some things for me. I'll just post here what I told him.

For clarity of the following, let us say that using sprite_set_alpha_from_sprite(sprite1,sprite2) alters the alpha of sprite1 using the pixels of sprite2. From my GM8 tests it appears that only the RGB channels of the sprite2 are used to calculate the alpha applied to the sprite1. The alpha of sprite2 has no effect on the calculated alpha. When the calculated alpha is applied to sprite1, the existing alpha of sprite1 is multiplied by it, rather than replaced by it. If the alpha of sprite1 is 0.7, and the calculated alpha from sprite2 is 0.3, the resulting alpha of sprite1 will be 0.21.

I have not yet tested the background-based variant of this function, nor earlier versions of Game Maker. I presume they all work identically.


Abusing forum power since 1986.

Offline

Board footer

Powered by FluxBB