Skip to content

Commit

Permalink
feat: Add thanks for playing screen
Browse files Browse the repository at this point in the history
  • Loading branch information
johnedvard committed Sep 12, 2022
1 parent 752cd9b commit f77b0ff
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Level.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { initGameHints } from './gameHints';
import { Goal } from './Goal';
import { Heart } from './Heart';
import { on } from './kontra';
import { showOverlay } from './menu';
import { Player } from './Player';
import { Saw } from './Saw';
import { playDead } from './sound';
Expand Down Expand Up @@ -36,6 +37,7 @@ export class Level {
this.init(levelData);
})
.catch(() => {
showOverlay('thanks');
// TODO (johnedvard) improve error handling, not always assume last level
});
}
Expand Down
7 changes: 7 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
<button id="nextBtn">Play next level</button>
<button id="replayBtn">Replay level</button>
</div>
<div id="thanks" class="overlay hide">
Rest in peace my soul
<br />
<br />
<br />
More levels for NEAR users
</div>
<div id="hint"></div>
</div>
</body>
Expand Down
11 changes: 9 additions & 2 deletions src/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ import { doesOwnNft, getNearLevel } from './utils';
import { initGameHints } from './gameHints';
import { getIsPlaying } from './sound';

const overlayIds = ['main', 'bonus', 'levels', 'level-dialog', 'near-levels'];
const overlayIds = [
'main',
'bonus',
'levels',
'level-dialog',
'near-levels',
'thanks',
];
const levels = 5;

let hasRemovedDisableOnBonusEls = false;
Expand Down Expand Up @@ -205,7 +212,7 @@ const onNearLevelClick = (btn) => {
}
};

const showOverlay = (id) => {
export const showOverlay = (id) => {
initGameHints(null);
overlayIds.forEach((o) => {
const overlayEl = document.getElementById(o);
Expand Down
5 changes: 5 additions & 0 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ button:hover img {
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
#thanks {
width: 80%;
height: 80%;
}

.level-item {
Expand Down

0 comments on commit f77b0ff

Please sign in to comment.