Fading in and out (Music)

scorelessmusicscorelessmusic Member Posts: 565
Any chance that it's possible to control music fading in and out?

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    Yes, I do it in my game Stunt Squirrels when you change to scenes with different bg music. It's subtle, but I think it makes a difference.

    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
  • scorelessmusicscorelessmusic Member Posts: 565
    Thanks, that's a nice tip! :) I'll probably implement that just so I don't forget it. The only issue might be if I want to specifically fade in and out the music track only without affecting the volume of SFX.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Actually, the game.Audio.Volume Attribute only affects the bg music. SFX are controlled separately.

    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.
  • scorelessmusicscorelessmusic Member Posts: 565
    Thanks for clarifying. I thought when it mentions 'global' that it was some master volume. I should check it out now. :)

    The attributes sound like a good way to go and I'll follow suit.
Sign In or Register to comment.