Update 'btn'
23
btn.md
23
btn.md
@@ -4,6 +4,29 @@ Aquesta funció torna `true` o `false` segons la tecla que s'especifica com a pa
|
||||
`tecla`
|
||||
Una de les [constants](teclat) asociades al teclat.
|
||||
|
||||
### Exemple
|
||||
```
|
||||
function init()
|
||||
x,y = 10,7
|
||||
setmode(2)
|
||||
end
|
||||
|
||||
function update()
|
||||
cls()
|
||||
if btn(KEY_UP) then
|
||||
y = mid(0,y-1,14)
|
||||
elseif btn(KEY_DOWN) then
|
||||
y = mid(0,y+1,14)
|
||||
end
|
||||
if btn(KEY_LEFT) then
|
||||
x = mid(0,x-1,19)
|
||||
elseif btn(KEY_RIGHT) then
|
||||
x = mid(0,x+1,19)
|
||||
end
|
||||
color(COLOR_YELLOW,COLOR_BLACK)
|
||||
print("\224", x, y)
|
||||
end
|
||||
```
|
||||
### Vore també
|
||||
* [btnp(tecla)](btnp)
|
||||
* [Constants de teclat](teclat)
|
||||
|
||||
Reference in New Issue
Block a user