• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Fading slowly

T

Tony

Guest
I want to fade a sprite slowly. Other people have recommending putting a script in the step event, so that it fades a little bit with each step until it is no longer visible. This doesn't seem like an optimized solution. Is there a better way?

Also, what about scaling an object slowly, such as a health bar?
 

jo-thijs

Member
Hi and welcome to the GMC!

I see no reason why that would look like an unoptimized solution.

Scaling a health bar slowly can be done in the same way,
have some variable (image_xscale) change a little bit every step.
 

Yal

šŸ§ *penguin noises*
GMC Elder
The "optimized" solution would be to instantly change to the alpha you want :p

Fades need to take place in the step event since one step is the smallest unit of time GM natively supports - if you don't use the step events somehow, you can't make an arbitrary value change over time. (You can make position change over time by using the built-in speeds or paths, but not anything else. You can use alarms to change stuff after a set time, but not smoothly in the same way step events would allow... unless you have an alarm trigger setting itself over and over... which practically would emulate the step event)
 
Top