Will the attached help. The extra parameter to button() checks for button pressed instead of held down. Vsync makes you not go too fast. Finally millisec keeps track of elapsed time. Hope that helps.