Add crashing
This commit is contained in:
parent
bd97945e66
commit
60f77c36a9
9 changed files with 67 additions and 10 deletions
|
@ -26,7 +26,7 @@ export function tick() {
|
|||
|
||||
if (state.editing) {
|
||||
tickEditing();
|
||||
} else if (state.playing) {
|
||||
} else if (state.playing && !state.gameOver) {
|
||||
tickPlaying();
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,10 @@ export function tick() {
|
|||
}
|
||||
}
|
||||
|
||||
if (state.gameOver) {
|
||||
audio.stop('engine');
|
||||
}
|
||||
|
||||
if (pressed[mapping.toggleMusic]) {
|
||||
audio.toggle('music');
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ function notify(message, time = 80) {
|
|||
|
||||
export function tick() {
|
||||
if (notification === null) return;
|
||||
if (notLife-- <= 0)
|
||||
if (notLife-- <= 0 || game.state.gameOver)
|
||||
notification.text = '';
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,12 @@ export function launchShip() {
|
|||
game.state.landed = false;
|
||||
}
|
||||
|
||||
export function crash() {
|
||||
audio.play('crash');
|
||||
particle.createCrash(world.playerShip)
|
||||
game.state.gameOver = true;
|
||||
}
|
||||
|
||||
export function toggleEdit() {
|
||||
if (game.state.editing) {
|
||||
endEditing();
|
||||
|
@ -122,6 +128,7 @@ export function tilePlacement() {
|
|||
|
||||
export function tossItem() {
|
||||
particle.createItemToss(world.playerShip);
|
||||
audio.play('toss');
|
||||
}
|
||||
|
||||
export function collectItem(type, id, name) {
|
||||
|
|
|
@ -16,7 +16,8 @@ export async function init() {
|
|||
playing: false,
|
||||
editing: false,
|
||||
paused: false,
|
||||
inventory: false
|
||||
inventory: false,
|
||||
gameOver: false
|
||||
};
|
||||
|
||||
graphics.init();
|
||||
|
@ -24,8 +25,8 @@ export async function init() {
|
|||
gui.init();
|
||||
input.init();
|
||||
|
||||
//events.playMusic();
|
||||
events.startGame();
|
||||
events.playMusic();
|
||||
//events.startGame();
|
||||
|
||||
//tick(); return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue