Page 1 of 1
Where i must put this in code?
Posted: Fri Aug 22, 2014 1:45 pm
by IceQB
HI all
First time I have weird problem like that.
so i have code
Code: Select all
if item[1] == used then
min_items = min_items + 1
eq_selected = eq_selected + 1
item_pos = item_pos - 200
end
Problem is that, if i put this in update then commands repeats in infinity, but when i put this in load its not work... soo what i do wrong?
Re: Where i must put this in code?
Posted: Fri Aug 22, 2014 2:07 pm
by Plu
Depends on what the behaviour
should be. I'm guessing it should be run
once, when you set the value to used?
In that case, it should go in update
but you should add an extra line that removes the used value again so that it doesn't run indefinately.
Code: Select all
if item[1] == used then
min_items = min_items + 1
eq_selected = eq_selected + 1
item_pos = item_pos - 200
item[1] = not_used -- or whatever the alternative to the used variable is!
end
That should only make it work once per trigger. Keep in mind that if the trigger is something like love.keyboard.isDown() it'll still keep triggering constantly as long as the key is pressed.
Re: Where i must put this in code?
Posted: Fri Aug 22, 2014 2:17 pm
by IceQB
Thanks, now everything works!