Code: Select all
function love.update()
if love.keyboard.isDown("w") then
py = py - 1
end
if love.keyboard.isDown("s") then
py = py + 1
end
if love.keyboard.isDown("a") then
px = px - 1
end
if love.keyboard.isDown("d") then
px = px + 1
end
if love.keyboard.isDown("lshift" and "w") then
py = py - 10
elseif love.keyboard.isDown("lshift" and "s") then
py = py + 10
end
if love.keyboard.isDown("lshift" and "a") then
px = px - 10
elseif love.keyboard.isDown("lshift" and "d") then
px = px + 10
end
Code: Select all
ws = false
ss = false
as = false
ds = false
function love.update()
while(ws == true) do
py = py - 10
end
while(ss == true) do
py = py + 10
end
while(as == true) do
px = px - 10
end
while(ds == true) do
px = px + 10
end
end
function love.keypressed(key)
if key == "right" then
if key == down then
px = px + 3
end
end
if key == "lshift" and key == "s" then
ss = true
end
if key == "lshift" and key == "a" then
as = true
end
if key == "lshift" and key == "d" then
ds = true
end
end
function love.keyreleased(key)
if key == "lshift" and "w" then
ws = false
end
if key == "lshift" and "s" then
ss = false
end
if key == "lshift" and "a" then
as = false
end
if key == "lshift" and "d" then
ds = false
end
end