Skip to content
Filippo edited this page Jan 28, 2017 · 25 revisions

##btnp btnp [id: 0..5 8..13 [hold period] ] -> pressed (but wasn't pressed in previous frame)

##Parameters: id : the id of the key we need to interrogate, see the key map for reference
hold period : the duration the key must be kept pressed to return another true value. Useful in scrolling menu items.

##Description: This function allow to read the status of one of the buttons attached to the TIC. The function report a true value only in the moment the key is pressed.
It can be used also with a period parameter that allow to return a true value while keeping the key pressed, after the period is elapsed.

##Example:

-- btnp demo: move the rectangle in 10 pixels step, 
-- every time one direction keys is pressed

x=120
y=80

cls(12) 
function TIC()

	if btnp(0) then y=y-10 end
	if btnp(1) then y=y+10 end
	if btnp(2) then x=x-10 end
	if btnp(3) then x=x+10 end

	rect(x,y,10,10,8)		
end
Clone this wiki locally