Complex input checking.

BlitzMax Forums/BlitzMax Beginners Area/Complex input checking.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I modified brucey's code some what. I think this is what you want:
SuperStrict

Graphics 640,480

Local oldButtons:Int, buttons:Int

Local leftKey:Int = key_z
Local rightKey:Int = key_x
Local zap:Int = False
Local counter1% = 0
Local counter2% = 0
Local counter3% = 0


SetColor(255, 255, 255)

While Not KeyDown(key_escape)

	Cls
	
	buttons = KeyDown(leftKey) * 1 | KeyDown(rightKey) * 2
	
	If Not buttons Then
		If counter3  And counter3 < 8 Then
			DrawText "ZAP !", 100, 100
			DebugLog "Zap !"
			counter3 = 0
		Else
			counter3 = 0
		End If
			
		
	Else If buttons = 1  Then
		counter1:+ 1
		If counter1 > 3 Then
		    DrawText "Moving Left", 100, 100
			counter2 = 0
			counter3 = 0
		EndIf
	Else If buttons = 2 Then
	    counter2 :+ 1
		If counter2 > 3
			DrawText "Moving Right", 100, 100
			counter1 = 0
			counter3 = 0
		EndIf
		
	End If
	If buttons = 3 Then
		counter3 :+1
		If counter3 > 3
		counter1 = 0
		counter2 = 0
		EndIf
	EndIf
	oldButtons = buttons
	
	Flip
	
Wend



[edited]