Limiting guy's movement within the screen

This commit is contained in:
2021-11-11 21:52:58 +01:00
parent f68e790400
commit bc3341bc07

View File

@ -18,10 +18,10 @@ guyspeedx=2
guyspeedy=2
function moveguy()
if (btn(0)) guyposx-=guyspeedx
if (btn(1)) guyposx+=guyspeedx
if (btn(2)) guyposy-=guyspeedy
if (btn(3)) guyposy+=guyspeedy
if (btn(0)) guyposx=max(0,guyposx-guyspeedx)
if (btn(1)) guyposx=min(127,guyposx+guyspeedx)
if (btn(2)) guyposy=max(0,guyposy-guyspeedy)
if (btn(3)) guyposy=min(127,guyposy+guyspeedy)
end
function drawguy()