I have wrote this, it just makes "LOL?" Fade and enlarge where you click but after a few clicks the program really starts to lag, why could this be? Is it my code or is it Love?
I realise that a few things can be done (making things else if, but I wasn't sure how to do that in lua) but I doubt they'd hinder the performance
Code: Select all
function load()
love.graphics.setFont(love.graphics.newFont(love.default_font, 20))
text = "LOL?"
alpha = 255
size = 20
love.mouse.setVisible(false)
X = love.mouse.getX()
Y = love.mouse.getY()
end
function update(dt)
temp = angle
if alpha >= 0 then
alpha = alpha - 15
end
if alpha < 0 then
click = false
alpha = 255
end
if alpha % 10 then
size = size + 1
end
if click == false then
alpha = 255
size = 20
end
X = love.mouse.getX()
Y = love.mouse.getY()
end
function draw()
love.graphics.setColor(255, 255, 255, 255)
love.graphics.setFont(love.graphics.newFont(love.default_font, 20))
love.graphics.draw(text, X, Y)
if click then
love.graphics.setColor(255, 255, 255, alpha)
love.graphics.setFont(love.graphics.newFont(love.default_font, size))
love.graphics.draw(text, tempX, tempY)
end
end
function mousepressed(x, y, button)
if button == love.mouse_left then
click = true
tempX = x
tempY = y
end
end