Skip to content

Commit

Permalink
Merge pull request ivanseidel#40 from tiagosomda/master
Browse files Browse the repository at this point in the history
Fixed page reload bug for windows OS
  • Loading branch information
ivanseidel committed Dec 17, 2016
2 parents b579424 + 8e3ab2a commit 50e46ca
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion GameManipulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(' ');
Expand All @@ -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
//
Expand Down

0 comments on commit 50e46ca

Please sign in to comment.