It doesn't detect when you hit a key, it detects when your screen moves which the arrow keys do. Basically it would have to be in only 1 place with a centered view and whenever you hit right it will move screen to right, and it would detect when it would go to at least whatever X position (it would depend where screen is centered).