Updating dynamic high score in-game.

master
Ben Burlingham 9 years ago
parent e3a09c540e
commit fb6155a30d
  1. 4
      components/board/scorebar.component.js
  2. 3
      controllers/board/scorebar.controller.js
  3. 2
      models/multiples.model.js
  4. 4
      sass/board/scorebar.scss

@ -11,8 +11,8 @@ export class Scorebar extends Component {
}
return (<div className='scorebar'>
<div className='item current-score'>{this.props.current}</div>
<div className='item high-score'>{this.props.high}</div>
<div className='item currentscore'>{this.props.current}</div>
<div className='item highscore'>{this.props.high}</div>
<div className='item lives'>{lives}</div>
</div>);
};

@ -1,7 +1,7 @@
import * as ScorebarActions from '../../actions/board/scorebar.actions';
import SETTINGS from '../../AppSettings';
const stored = localStorage.getItem(SETTINGS.LOCAL_STORAGE_KEY) || [{ score: 0 }];
const stored = JSON.parse(localStorage.getItem(SETTINGS.LOCAL_STORAGE_KEY)) || [{ score: 0 }];
let dispatch;
let lives = SETTINGS.LIVES;
@ -27,6 +27,7 @@ const ScorebarCtrl = {
highScore = previousHighScore;
}
dispatch(ScorebarActions.update(lives, currentScore, highScore));
},

@ -5,7 +5,7 @@ const MultiplesModel = Object.create(BaseModel);
MultiplesModel.generate = function(n, level) {
const multiples = [];
const nonmultiples = [];
const target = 19//level + 2;
const target = level + 2;
const upperLimit = target * 150;
let tmp;

@ -17,11 +17,11 @@
vertical-align:top;
}
.current-score {
.currentscore {
width:35%;
}
.high-score {
.highscore {
text-align:center;
width:30%;
}

Loading…
Cancel
Save