Fixed problems in the code

changed the while loop to an if statement so the game won't freeze up.  Passed in window.isRunning to pass the isRunning variable by reference instead of value.