Change game loop. Use while loop for logic update inside requestAnimFrame