This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials
Create point and click adventures without coding. The free version covers up to 25 scenes per project. For more scenes or to earn money with your game, you need a license.
See the Indie Bundle Try it for free-- let's create a function to smoothly increase/decrease music volume without using mainLoop function
function setMusicVol(sta, vol)
if sta == 1 then
repeat
if getVolume(eMusicVolume) > vol then setVolume(eMusicVolume, getVolume(eMusicVolume) - 1) end
--print("volume:" .. getVolume(eMusicVolume)) --testing only!
until getVolume(eMusicVolume) <= vol
elseif sta == 2 then
repeat
if getVolume(eMusicVolume) < vol then setVolume(eMusicVolume, getVolume(eMusicVolume) + 1) end
--print("volume:" .. getVolume(eMusicVolume)) --testing only!
until getVolume(eMusicVolume) >= vol
end
end
-- let's create the increase/decrease music volume function
function adjMusicVol(sta, val)
if sta == 1 then
if getVolume(eMusicVolume) > 0 then setVolume(eMusicVolume, getVolume(eMusicVolume) - val) end
if getVolume(eMusicVolume) < 0 then setVolume(eMusicVolume, 0) end
elseif sta == 2 then
if getVolume(eMusicVolume) < 100 then setVolume(eMusicVolume, getVolume(eMusicVolume) + val) end
if getVolume(eMusicVolume) > 100 then setVolume(eMusicVolume, 100) end
end
end
Thanks for the scripts lee. Thats fantastic.
You know what? The + and - Keys didnt work to increase/decrease the music... because i tried to use the keys from the numeral part on the right of my laptop-keyboard. ^^ The MAIN Keys are working.