i am just training on love. i decided to make a little program which is kind a showcase of flux tweening library. in scenario it must change the tweening ease at every click. but unfortunately, i could not change the index of the "easemods" by every single clicking. here is my code, where do i make the mistake?
Code: Select all
flux = require "flux"
function love.load()
player={x = 100, y = 100} --> start point of the player
easemodes={"linear", "quadin", "quadout", "quadinout", "cubicin", --> ease modes of the flux lib
"cubicout", "cubicinout", "quartin", "quartout", "quartinout",
"quintin", "quintout", "quintinout", "expoin", "expoout",
"expoinout", "sinein", "sineout", "sineinout", "circin",
"circout", "circinout", "backin", "backout", "backinout",
"elasticin", "elasticout", "elasticinout"}
n=1 --> ease modes indexer. this should be iterated by clicking
end
function love.update(dt)
flux.update(dt)
flux.to(player, 2, {x=love.mouse.getX(),y=love.mouse.getY()}):ease(easemodes[n]) --> the square follows the mouse cursor here. alse ease mode is selected
if love.mouse.isDown("l") then --> my wrong code which cant change "n" by clicking. my question about here mostly
if not love.mouse.isDown("l") then
n=n+1
end
end
end
function love.draw()
love.graphics.print(easemodes[n],20,20) --> shows which mode we are at
love.graphics.setColor(255, 0, 0, 255)
love.graphics.rectangle("fill", player.x, player.y, 10, 10)
end