victory screen beats hit

This commit is contained in:
Kevin Ngo
2018-11-17 03:27:40 -08:00
parent a1ca2aee92
commit 02f33c63fb
2 changed files with 23 additions and 3 deletions

View File

@@ -79,6 +79,7 @@ AFRAME.registerState({
accuracy: 0,
beatsHit: 0,
beatsMissed: 0,
beatsText: '',
combo: 0,
maxCombo: 0,
multiplier: 1,
@@ -209,9 +210,12 @@ AFRAME.registerState({
state.isVictory = true;
state.menuActive = false;
state.score.accuracy = 74.99;
state.score.beatsHit = 125;
state.score.beatsMissed = 125;
state.score.maxCombo = 123;
state.score.rank = 'B';
state.score.score = 9001;
computeBeatsText(state);
},
gamemenuresume: (state) => {
@@ -429,6 +433,8 @@ AFRAME.registerState({
} else {
state.score.rank = 'F';
}
computeBeatsText(state);
},
wallhitstart: function (state) {
@@ -548,3 +554,8 @@ function formatSongLength (songLength) {
const minutes = `${Math.floor(songLength)}`;
return `${minutes}:${Math.round((songLength - minutes) * 60)}`;
}
function computeBeatsText (state) {
state.score.beatsText =
`${state.score.beatsHit} / ${state.score.beatsMissed + state.score.beatsHit} BEATS`;
}