Limiting guy's movement within the screen
This commit is contained in:
8
pyras.p8
8
pyras.p8
@ -18,10 +18,10 @@ guyspeedx=2
|
|||||||
guyspeedy=2
|
guyspeedy=2
|
||||||
|
|
||||||
function moveguy()
|
function moveguy()
|
||||||
if (btn(0)) guyposx-=guyspeedx
|
if (btn(0)) guyposx=max(0,guyposx-guyspeedx)
|
||||||
if (btn(1)) guyposx+=guyspeedx
|
if (btn(1)) guyposx=min(127,guyposx+guyspeedx)
|
||||||
if (btn(2)) guyposy-=guyspeedy
|
if (btn(2)) guyposy=max(0,guyposy-guyspeedy)
|
||||||
if (btn(3)) guyposy+=guyspeedy
|
if (btn(3)) guyposy=min(127,guyposy+guyspeedy)
|
||||||
end
|
end
|
||||||
|
|
||||||
function drawguy()
|
function drawguy()
|
||||||
|
Reference in New Issue
Block a user