Fading in and out (Music)
scorelessmusic
Member Posts: 565
Any chance that it's possible to control music fading in and out?
Comments
You have access to the global Volume Attribute.
Control that with a Rule and a Timer, like this:
Fade Out:
Rule
When game.Volume > 0
Timer
Every 0.01
Change Attribute game.Volume to game.Volume - 0.01
------
Fade In:
Rule
When game.Volume < 1
Timer
Every 0.01
Change Attribute game.Volume to game.Volume + 0.01
I keep two global game attributes, musicVolume and sfxVolume. I fade those in and out. The music and sound volumes are set to those attributes' values.
The attributes sound like a good way to go and I'll follow suit.