Add instructions
This commit is contained in:
parent
60f77c36a9
commit
2959c39da7
10 changed files with 119 additions and 21 deletions
|
@ -46,7 +46,7 @@ export function tick() {
|
|||
}
|
||||
|
||||
function tickPlaying() {
|
||||
if (held[mapping.thrust]) {
|
||||
if (held[mapping.thrust] && playerShip.fuel !== 0) {
|
||||
playerShip.applyThrust({ forward: 1 });
|
||||
let vol = Math.min(0.7, graphics.perspective.zoom / 10);
|
||||
audio.volume('engine', vol);
|
||||
|
@ -55,7 +55,11 @@ function tickPlaying() {
|
|||
}
|
||||
|
||||
if (pressed[mapping.thrust]) {
|
||||
audio.start('engine');
|
||||
if (playerShip.fuel !== 0) {
|
||||
audio.start('engine');
|
||||
} else {
|
||||
audio.stop('engine');
|
||||
}
|
||||
}
|
||||
|
||||
if (held[mapping.left]) {
|
||||
|
|
|
@ -17,7 +17,7 @@ let landedPlanets = new Set();
|
|||
|
||||
export function playMusic() {
|
||||
audio.start('music');
|
||||
audio.volume('music', 0.8);
|
||||
audio.volume('music', 0.4);
|
||||
}
|
||||
|
||||
export function stopMusic() {
|
||||
|
@ -45,6 +45,14 @@ export function startGame() {
|
|||
graphics.perspective.focusPlayer();
|
||||
}
|
||||
|
||||
export function toMenu() {
|
||||
game.changeView('menu');
|
||||
}
|
||||
|
||||
export function togglePause() {
|
||||
game.state.paused = !game.state.paused;
|
||||
}
|
||||
|
||||
export function landShip(planet) {
|
||||
shipLanded = true;
|
||||
if (!landedPlanets.has(planet)) {
|
||||
|
@ -54,7 +62,7 @@ export function landShip(planet) {
|
|||
}
|
||||
|
||||
export function howToPlay() {
|
||||
game.state.controls = true;
|
||||
game.changeView('instructions');
|
||||
}
|
||||
|
||||
function newPlanet(planet) {
|
||||
|
|
|
@ -41,12 +41,17 @@ export function changeView(view) {
|
|||
state.view = view;
|
||||
gui.changeView(view);
|
||||
|
||||
if (view == 'game') {
|
||||
if (view === 'game') {
|
||||
state.playing = true;
|
||||
state.editing = false;
|
||||
state.paused = false;
|
||||
world.init();
|
||||
inventory.init();
|
||||
} else if (view === 'instructions') {
|
||||
state.playing = false;
|
||||
gui.changeView('instructions');
|
||||
} else if (view === 'menu') {
|
||||
gui.changeView('menu');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue