Skip to content

Commit

Permalink
Merge branch 'offline' of https://github.com/codephil-columbia/typephil
Browse files Browse the repository at this point in the history
… into offline
  • Loading branch information
francesar committed Jul 20, 2019
2 parents 3c984ca + 6c60662 commit 2c84b30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/SpaceraceGame.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ class SpaceraceGame extends React.Component {
componentWillUnmount() {
document.removeEventListener('keydown', this.registerUserKeyPress);
clearTimeout(this.state.timeOutInstance)
clearInterval(this.state.ref1)
clearInterval(this.state.ref2)
clearInterval(this.state.ref3)
}

exitMainPage = (difficulty) => {
Expand Down Expand Up @@ -249,7 +252,7 @@ class SpaceraceGame extends React.Component {
this.setState({
level:this.state.level +1,
wpm:this.state.wpm + 5,
ref3:setInterval(this.spawnRocket,this.state.wpm/60 *10000)
ref3:setInterval(this.spawnRocket,60/this.state.wpm *1000)
})
}

Expand Down Expand Up @@ -456,13 +459,13 @@ class SpaceraceGame extends React.Component {
} = this.state;

if (difficultySelected === "easy"){
this.setState({AvailableWords: AllWords.slice(0, 145)})
this.setState({AvailableWords: AllWords.slice(0, 159)})
shuffle(AvailableWords)
}else if (difficultySelected === "hard"){
this.setState({AvailableWords: AllWords.slice(408, -1)})
this.setState({AvailableWords: AllWords.slice(446, -1)})
shuffle(AvailableWords)
}else {
this.setState({AvailableWords: AllWords.slice(145, 409)})
this.setState({AvailableWords: AllWords.slice(160, 477)})
shuffle(AvailableWords)
}
}
Expand Down Expand Up @@ -493,7 +496,7 @@ class SpaceraceGame extends React.Component {
startRocketSpawning:true,
ref1:setInterval(this.tick,1000),
ref2:setInterval(this.checkDifficultyIncrement, 1000),
ref3:setInterval(this.spawnRocket,this.state.wpm/60 *10000)
ref3:setInterval(this.spawnRocket, 60/this.state.wpm *1000)
})
}
} else if (keyPressed === BACKSPACE) {
Expand Down
Loading

0 comments on commit 2c84b30

Please sign in to comment.