Posted 01 June 2015 - 10:46 AM
Well you see i'm making a game in Lua and to sense button pushes i'm using os.pullEvent("key"). But my big problem is that os.pullEvent() pauses the program. I was wondering if there is any way i can set a time limit to how long os.pullEvent() will wait? It would be a big help! But if there is any other way to take input ( that may be better) i will accept that too :)/>
A copy of my movement code:
A copy of my movement code:
function movement() -- This block handles movement
a, b = os.pullEvent("key")
if b == 30 then
p1x = p1x - 1
elseif b == 32 then
p1x = p1x + 1
elseif b == 17 then
p1y = p1y - 1
elseif b == 31 then
p1y = p1y + 1
else
end
if b == 203 then
p2x = p2x - 1
elseif b == 205 then
p2x = p2x + 1
elseif b == 200 then
p2y = p2y - 1
elseif b == 208 then
p2y = p2y + 1
else
end
end