; JoyHit Example ; -------------- Graphics 640,480,0,2 SetBuffer BackBuffer() count=0 flash=0 While Not KeyDown(1) Cls If JoyType()=0 Then Text 0,0,"Esc: exit" Text 0,60,"No joystick detected - plug in a gamepad to try this example." Text 0,80,"With one attached, tapping button 1 bumps the counter below." Else Text 0,0,"Tap joystick button 1 (holding does not autofire) Esc: exit" End If ; JoyHit returns how many times the button was PRESSED since the ; last call - holding it down counts only once. ; (Compare JoyDown, which stays 1 while the button is held.) hits=JoyHit(1) count=count+hits If hits>0 Then flash=10 ; A muzzle flash marks each fresh press If flash>0 Then flash=flash-1 Color 255,220,0 Oval 295,215,50,50,True Color 255,255,255 End If Text 0,20,"JoyHit(1) presses counted so far: "+count Flip Wend End