code - setting opacity

for Stencyl 2.0 
useful for hover info panels,
code: 
No opacity: g.setOpacity(Math.min(0,256)); 
50% opacity: g.setOpacity(Math.min(128,256)); 
100% opacity: g.setOpacity(Math.min(256,256));
game attribute for in-game change: g.setOpacity(Math.min((getGameAttribute("opacity") as Number),256))

however, one can fill the sinppet below with game attribute, common attribute or a number from a list


anyway, it can insignificantly reduce the lag with as there is no additional "twist"
g.setOpacity(Math.min((0,256));
g.setOpacity(Math.min((0*2.56),256));

For Stencyl 4.0 and later, 
g. alpha = 1 // default value
g. alpha =  0.5 //50% opacity. 
g. alpha =  0.2 //20% opacity

No comments:

Post a Comment