hello i am trying to make a paint program i works very simple but when i click a second time it doesn't make a new pixel it moves the origanil pixel. Im hoping you could check out my code and see what is wrong.
function love.load()
mousex = 0
mousey = 0
clicked = false
cursor = love.mouse.newCursor("images/brush.png", 1, 1 )
love.mouse.setCursor(cursor)
end
function love.update(dt)
end
function love.draw()
if clicked == true then
love.graphics.circle("fill",mousex,mousey,5,100)
end
end
function love.mousepressed(x,y,button)
if button == "l" then
clicked = true
mousex = x
mousey = y
end
end
function love.mousereleased(x, y, button)
clicked = false
end
What you program does, is saving the coordinates of the last clicked position and draws a circle at that place. I'd call that a vector graphics approach. What you probably want is a pixel graphics approach. That means that you would not store the positions of individual objects, but instead store the color of each pixel on screen. That can be done using a Canvas. (warning: Canvases are not supported by all graphics cards. So your game might not run on every computer).
thanks sort of I don't really get how to make that as i never used canvases beforeif you could provide a tutorial for canvases that could be great also just saying the code on how to do it would be fine
look at my horse my horse is amazing taste my horese he taste like a raisin