Add music

This commit is contained in:
asraelite 2018-03-07 14:23:45 +00:00
parent 194c0bf846
commit bd97945e66
14 changed files with 82 additions and 20 deletions

View file

@ -14,7 +14,8 @@ export const mapping = {
inventory: 'KeyE',
cycleRotation: 'KeyC',
toggleTrace: 'KeyT',
toggleMarkers: 'KeyR'
toggleMarkers: 'KeyR',
toggleMusic: 'KeyM'
};
let held, pressed;
@ -34,11 +35,17 @@ export function tick() {
graphics.changeZoom(-input.mouse.scroll);
}
}
if (pressed[mapping.toggleMusic]) {
audio.toggle('music');
}
}
function tickPlaying() {
if (held[mapping.thrust]) {
playerShip.applyThrust({ forward: 1 });
let vol = Math.min(0.7, graphics.perspective.zoom / 10);
audio.volume('engine', vol);
} else {
audio.stop('engine');
}