Update 'mid'
17
mid.md
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
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user