Quick Question

I've got a warp trail coming from my ship that I want to slowly dissipate once the ship drops from warp. The code I'm using right now is:

image_alpha--;

This is faster than I want. How would I slow it down?
Thanks guys.
 

SoapSud39

Member
image_alpha goes from 0 to 1, and 'variable--; ' reduces the variable by 1 (integer). Unless I've got something terribly wrong, you're just setting the image_alpha to 0 immediately. So reducing image_alpha by an amount less than 1 (such as 0.000000000000000000000000000000000000000000000000000000001) should be good. Or if you want to control how many frames it takes, reduce a variable by 1 every frame (e.g. alpha_variable--;) and then set that out of length of time: image_alpha = alpha_variable / 30;

image_alpha should stop at 0, but if you're concerned about negative numbers eventually looping to positive, use max() function
 
Top