From 8e3ab2ac51bd171ef6c5b485abe140ab7522137a Mon Sep 17 00:00:00 2001 From: Somda Date: Wed, 16 Nov 2016 17:52:13 -0800 Subject: [PATCH] fixed page reload bug for windows OS --- GameManipulator.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/GameManipulator.js b/GameManipulator.js index 80f5dfd..55c2c27 100755 --- a/GameManipulator.js +++ b/GameManipulator.js @@ -208,7 +208,7 @@ GameManipulator.startNewGame = function (next) { // Press space to begin game (repetidelly) _startKeyInterval = setInterval(function (){ // Due to dino slowly gliding over the screen after multiple restarts, its better to just reload the page - robot.keyTap('r','command'); + GameManipulator.reloadPage(); setTimeout(function() { // Once reloaded we wait 0.5sec for it to let us start the game with a space. robot.keyTap(' '); @@ -228,6 +228,19 @@ GameManipulator.startNewGame = function (next) { } +// reload the page +GameManipulator.reloadPage = function () +{ + // retrieves platform + var platform = process.platform; + + if(/^win/.test(process.platform)) { + robot.keyTap('r','control'); + } else if(/^darwin/.test(process.platform)) { + robot.keyTap('r','command'); + } +} + // Compute points based on sensors //