Help with love.mousepressed function and while do loop
Posted: Mon Feb 10, 2014 9:43 pm
I have a little problem with the love.mousepressed function and while do loop.
(it has an error too)
I'm not very experienced with Lua but I did learn some programming languages earlier so I understand most of the things easily.
First, the image doesn't appear when I click somewhere in the game.
Second the character doesn't move slowly when I click where to go (with right click).
I don't know which operator is the "not equal to" so I used !=. I can't find the proper operator to use.
Here's the code of the functions
Hope you have a solution. Thanks.
(it has an error too)
I'm not very experienced with Lua but I did learn some programming languages earlier so I understand most of the things easily.
First, the image doesn't appear when I click somewhere in the game.
Second the character doesn't move slowly when I click where to go (with right click).
I don't know which operator is the "not equal to" so I used !=. I can't find the proper operator to use.
Here's the code of the functions
Code: Select all
function love.load()
...
mark = love.graphics.newImage("textures/mark.png")
...
end
Code: Select all
function love.mousepressed(MouseX, MouseY, button)
if button == "2" then
love.graphics.draw(mark, MouseX, MouseY)
while x != MouseX do
x = x + 1
player.graphics.draw(playerUp, x, y)
end
while y != MouseY do
y = y + 1
player.graphics.draw(playerDown, x, y)
end
end
end