1
0
forked from 0ad/0ad

Adjust main menu background scrolling speed and make submenu use random sounds when opening.

This was SVN commit r10179.
This commit is contained in:
WhiteTreePaladin 2011-09-03 03:18:40 +00:00
parent 8f26bff788
commit dfcabe4db3
2 changed files with 8 additions and 8 deletions

View File

@ -1,6 +1,6 @@
/*
DESCRIPTION : Audio functions (eg "pick a random sound from a list", "build a playlist") go here.
NOTES :
NOTES :
*/
// ====================================================================
@ -33,7 +33,7 @@ function newRandomSound(soundType, soundSubType, soundPrePath)
case "music":
var randomSoundPath = "audio/music/"
break;
case "voice":
case "effect":
randomSoundPath = soundPrePath + "/";
break;
default:
@ -80,7 +80,7 @@ function fadeIn (soundHandle, finalGain, fadeDuration)
// Adjust the gain of a sound from zero up to the given value.
soundHandle.fade(0, finalGain, fadeDuration)
return true;
return true;
}
// ====================================================================

View File

@ -27,10 +27,10 @@ function scrollBackgrounds()
// Offset the layers by oscillating amounts
var t = (t0 - new Date) / 1000;
var speed = 1/10;
var off1 = 0.10 * w * (1+Math.cos(t*speed));
var off2 = 0.18 * w * (1+Math.cos(t*speed)) - h*6/9;
var off3 = 0.20 * w * (1+Math.cos(t*speed));
var speed = 1/20;
var off1 = 0.02 * w * (1+Math.cos(t*speed));
var off2 = 0.12 * w * (1+Math.cos(t*speed)) - h*6/9;
var off3 = 0.16 * w * (1+Math.cos(t*speed));
var left = screen.right - w * (1 + Math.ceil(screen.right / w));
layer1.size = new GUISize(left + off1, screen.top, screen.right + off1, screen.bottom);
@ -137,7 +137,7 @@ function updateMenuPosition()
// Opens the menu by revealing the screen which contains the menu
function openMenu(newSubmenu, position, buttonHeight, numButtons)
{
var menuSound = new Sound("audio/attack/weapon/arrowfly_24.ogg");
var menuSound = new newRandomSound("effect", "arrowfly_", "audio/attack/weapon");
if (menuSound)
{
menuSound.play(0);