Oh and heres the code.
Code: Select all
function ScreenTouches()
local touches = love.touchpressed( )
released = love.touchreleased( )
for i, id in ipairs(touches) do
tchx, tchy = love.touch.getPosition(id)
end
end
function Touchpad()
if tchx > rx and tchx < rx+rightarrow:getWidth() and tchy > ry and tchy < ry+rightarrow:getHeight() then
player.x = player.x + player.speed * delt
end
if tchx > lx and tchx < lx+leftarrow:getWidth() and tchy > ly and tchy < ly+leftarrow:getHeight() then
player.x = player.x - player.speed * delt
end
if tchx > dx and tchx < dx+downarrow:getWidth() and tchy > dy and tchy < dy+downarrow:getHeight() then
player.y = player.y + player.speed * delt
end
if tchx > ux and tchx < ux+uparrow:getWidth() and tchy > uy and tchy < uy+uparrow:getHeight() then
player.y = player.y - player.speed * delt
end
end