Update 'mid'

2021-12-07 17:47:54 +01:00
parent 957b89e49d
commit 7b9220db00

17
mid.md

@@ -13,23 +13,14 @@ L'ultim valor a comparar.
### Exemple ### Exemple
``` ```
function init() function init()
setmode(2) setmode(1)
x,y=10,7
color(COLOR_YELLOW, COLOR_BLUE)
end end
function update() function update()
cls() cls()
if btn(KEY_UP) then local x = mid(0,mousex(),39)
y = max(0, y-1) local y = mid(0,mousey(),29)
elseif btn(KEY_DOWN) then print(x..","..y, 0, 0)
y = min(y+1, 14)
end
if btn(KEY_LEFT) then
x = max(0, x-1)
elseif btn(KEY_RIGHT) then
x = min(x+1, 19)
end
print("\224",x,y) print("\224",x,y)
end end
``` ```