Private
Public Access
1
0

on click opponents bomb, you cannot target && refactor

This commit is contained in:
2016-10-31 18:52:38 +01:00
parent 418f8f3b67
commit 625c0e9c91
2 changed files with 10 additions and 6 deletions

View File

@@ -352,11 +352,17 @@ class GridControl extends React.Component {
*/ */
onHoverWithBomb(coords) { onHoverWithBomb(coords) {
if (this.refs.userControl.state.bombSelected) { if (this.refs.userControl.state.bombSelected) {
/** clear cache, reset symbols */ var activePlayer = this.refs.userControl.state.activePlayer ? 'blue' : 'red';
this.bombClear();
/** new cache && field activate */ if (activePlayer === this.state.webPlayer) {
this.bombCreate(coords[0], coords[1]); /** clear cache, reset symbols */
this.bombClear();
/** new cache && field activate */
this.bombCreate(coords[0], coords[1]);
} else {
this.refs.userControl.setState({bombSelected: false});
}
} }
} }

View File

@@ -35,8 +35,6 @@ class GridField extends React.Component {
componentWillMount() { componentWillMount() {
var wave = Math.floor(Math.random() * 3) + 1; var wave = Math.floor(Math.random() * 3) + 1;
console.log('mounted');
this.setState({ this.setState({
currentImage: this.state.icons.root + this.state.icons.water[wave] currentImage: this.state.icons.root + this.state.icons.water[wave]
}); });