What I am trying to do with this is, that when I am going in one direction, I cannot be able to move in the opposite direction. So I created an equation for it: (4/3)*(x^3) - 10*(x^2)+ (65/3)*x - 10
Code: Select all
control = {"up", 1, "right", 2, "down", 3, "left", 4}
x =(4/3)*((control[1 + 1])^3)-10*((control[1 + 1])^2)+(65/3)*(control[1 + 1])-10
print(x) <---- 3 gets printed
if x == 3 then
print("dumm") <---- "dumm" is not printed, WHY????
end
What am I doing wrong?
This is my actual code, but the code above shows my problem more clearly, I think.
Code: Select all
if love.keyboard.isDown(control[1]) and direction ~= x and direction ~= control[1 + 1] then
-- if grid[frontX][frontY] + 1 ~= grid[frontX][frontY - 1] and verti ~= -1 then
direction = control[1 + 1]
-- end
end