click menu???????

BlitzPlus Forums/BlitzPlus Programming/click menu???????

You have to place the MouseHit() command into a variable if you intend on performing checks on it every time.

Remember, the ????Hit() commands clear their buffers once you use them even once.

in my programming tutorial, I comment on this in several of my example programs like so:

	;Collect user input
	upkey = KeyDown(200)	;up arrow		;It's a good practice to collect these inputs only once
	downkey = KeyDown(208)	;down arrow		; per loop.  This will prevent odd behaviors from happening,
	leftkey = KeyDown(203)	;left arrow		; for instance if the state of a key changes between multiple
	rightkey = KeyDown(205)	;right arrow		; checks of that key while still in the same loop.
	jumpkey = KeyDown(57)	;spacebar
	fastkey = KeyDown(42)	;left shift key
	
	If rightkey					;Check if the right key is being pressed
		If fastkey				;Check if the fast key is also being pressed
			xmove = 8			; if so, then attempt to move 8 pixels
		Else	
			xmove = 4			; if not, then only attempt to move 4 pixels
		EndIf
	EndIf
	If leftkey					;Check if the left key is being pressed
		If fastkey				;Check if the fast key is also being pressed
			xmove = -8			; if so, then attempt to move -8 pixels
		Else
			xmove = -4			; if not, then only attempt to move -4 pixels
		EndIf
	EndIf
Notice that I checked the fast key twice? This works because my variable will not change its value between my If statements. However, if I had checked the key directly, the user could have let go of the fast key between my two If statements.