oh and here is what I have so far for code, its just a cursor.
Code: Select all
function love.load()
cursor = {}
cursor.x = 385
cursor.y = 285
cursor.pixel = {}
cursor.draw = function()
pixel = {}
pixel.x = cursor.x
pixel.y = cursor.y
table.insert(cursor.pixel, pixel)
end
end
function love.draw(dt)
love.graphics.setColor( 100, 100, 100)
love.graphics.rectangle("fill", cursor.x, cursor.y, 3, 3)
end
function love.update(dt)
--cursor movement
if love.keyboard.isDown("up") then
cursor.y = cursor.y - 20
elseif love.keyboard.isDown("down") then
cursor.y = cursor.y + 20
end
if love.keyboard.isDown("left") then
cursor.x = cursor.x - 20
elseif love.keyboard.isDown("right") then
cursor.x = cursor.x + 20
end
--thx drunken_munki for help with diagonals
--cursor bounds
if cursor.y < 0 then
cursor.y= 1
end
if cursor.y > 600 then
cursor.y= 599
end
if cursor.x < 0 then
cursor.x= 1
end
if cursor.x > 800 then
cursor.x= 799
end
--drawing control
if love.keyboard.isDown("space") then
table.insert(cursor.pixel, pixel)
end
end