diff --git a/assets/img/molerat.jpg b/assets/img/molerat.jpg new file mode 100644 index 0000000..a70dcfc Binary files /dev/null and b/assets/img/molerat.jpg differ diff --git a/src/components/debug-state.js b/src/components/debug-state.js new file mode 100644 index 0000000..02651be --- /dev/null +++ b/src/components/debug-state.js @@ -0,0 +1,12 @@ +/** + * Emit events from query parameter to state to automatically set up state. + */ +AFRAME.registerComponent('debug-state', { + play: function () { + const flags = AFRAME.utils.getUrlParameter('debugstate').trim(); + if (!flags) { return; } + flags.split(',').forEach(flag => { + this.el.sceneEl.emit(`debug${flag.trim()}`, null, false); + }); + } +}); diff --git a/src/index.html b/src/index.html index b2f8129..a98e040 100644 --- a/src/index.html +++ b/src/index.html @@ -25,6 +25,7 @@ animation__gameoverfog="property: components.fog.el.object3D.fog.color; type: color; to: #330000; startEvents: gameover; dur: 500; easing: easeInQuad" console-shortcuts debug-controller + debug-state effect-bloom="strength: 1" gpu-preloader loading-screen="backgroundColor: #000;" @@ -122,6 +123,7 @@ bind__pause="isPaused: !isPlaying" sound__beathit="poolSize: 12; src: assets/sounds/beatHit.ogg"> {% include './templates/stage.html' %} + {% include './templates/loading.html' %} {% include './templates/score.html' %} {% include './templates/menu.html' %} {% include './templates/gameMenu.html' %} diff --git a/src/state/index.js b/src/state/index.js index ff6d5db..71b8fa9 100644 --- a/src/state/index.js +++ b/src/state/index.js @@ -65,9 +65,11 @@ AFRAME.registerState({ beatsMissed: 0, combo: 0, maxCombo: 0, + maxComboText: 0, multiplier: 1, rank: '', - score: 0 + score: 0, + scoreText: 0 }, search: { active: true, @@ -95,7 +97,7 @@ AFRAME.registerState({ state.damage -= DAMAGE_DECAY; } state.score.beatsHit++; - state.score.score++; + state.score.score += 1000; state.score.combo++; if (state.score.combo > state.score.maxCombo) { state.score.maxCombo = state.score.combo; @@ -133,6 +135,47 @@ AFRAME.registerState({ state.menuSelectedChallenge.songLength = undefined; }, + /** + * To work on game over page. + * + * ?debugstate=gameover + */ + debuggameover: state => { + state.isGameOver = true; + state.menuActive = false; + }, + + /** + * To work on victory page. + * + * ?debugstate=loading + */ + debugloading: state => { + state.menuActive = false; + state.isSongFetching = true; + state.isSongLoading = true; + state.menuSelectedChallenge.songName = 'Friday'; + state.menuSelectedChallenge.songSubName = 'Rebecca Black'; + $('#loadingSongImage').setAttribute('material', 'src', 'assets/img/molerat.jpg'); + }, + + /** + * To work on victory page. + * + * ?debugstate=victory + */ + debugvictory: state => { + state.isVictory = true; + state.menuActive = false; + state.score.accuracy = 'Accuracy: 99.99%'; + state.score.maxComboText = 'Max Combo: 123'; + state.score.rank = 'S'; + state.score.scoreText = 'Score: 9001'; + state.menuSelectedChallenge.songName = 'Friday'; + state.menuSelectedChallenge.songSubName = 'Rebecca Black'; + $('#gameMenuSongImage').setAttribute('material', 'src', 'assets/img/molerat.jpg'); + }, + gamemenuresume: (state) => { state.isPaused = false; }, diff --git a/src/templates/gameMenu.html b/src/templates/gameMenu.html index 86078a9..9a217c1 100644 --- a/src/templates/gameMenu.html +++ b/src/templates/gameMenu.html @@ -11,6 +11,7 @@ position="0 -0.07 0.01" text="align: center; wrapCount: 17; color: #F0F0F0"> + @@ -22,6 +23,8 @@ bind__visible="isGameOver || isPaused || isVictory" position="0 1.1 -2" play-sound="event: mouseenter; sound: #hoverSound; volume: 0.03"> + + - - + @@ -67,27 +69,35 @@ + - + + + text="align: center; color: #FAFAFA; wrapCount: 22; baseline: top; lineHeight: 36; width: 0.81" + bind__text="value: score.scoreText"> + + diff --git a/src/templates/loading.html b/src/templates/loading.html new file mode 100644 index 0000000..71ca52e --- /dev/null +++ b/src/templates/loading.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + diff --git a/src/templates/stage.html b/src/templates/stage.html index 642e821..365fbf5 100644 --- a/src/templates/stage.html +++ b/src/templates/stage.html @@ -113,46 +113,6 @@ - - - - - - - - - - - - - - - - - -