Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onTouchesBegan = async ({ pageX: x, pageY: y }) => {
if (this.gameEnded) {
this.gameEnded = false;
dispatch.score.reset();
dispatch.game.play();
} else if (Math.round(randomRange(0, 3)) === 0) {
// this.takeScreenshot();
}
this.moveSquare();
};
gameOver = (animate = true) => {
this.takeScreenshot();
this.screenShotTaken = false;
dispatch.score.reset();
this.score = 0;
dispatch.game.menu();
this.cachedRotationVelocity = 0;
if (animate) {
this.balls[this.mainBall].hide({ onComplete: () => this.reset() });
this.balls[1 - this.mainBall].hide({ duration: 0.4 });
for (const target of this.targets) {
target.animateOut();
}
} else {
this.reset();
}
};
async reset() {
super.reset();
dispatch.game.menu();
AudioManager.sharedInstance.playAsync('song', true, false);
await this.loadGame();
}
onPress = () => {
dispatch.game.menu();
if (this.props.onPress) this.props.onPress();
};
render() {