Add music
This commit is contained in:
parent
194c0bf846
commit
bd97945e66
14 changed files with 82 additions and 20 deletions
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue