@zorg Why are you that grumpy? I'm still learning and due to
not having anyone, who is familiar with Lua coding, besides of this forum, i only can ask an AI for help. So i think, it's a valid way to learn stuff.
@darkfrei Hey there again! Your code worked, thank you again for it! Now i only have to figure out, how to put everything into different loops for walking, running, jumping, attacking... And I'm almost done!
Just joking!
Can you explain, how it works? I see, that it is working, but i don't understand how and why
Code: Select all
love.update=function (dt)
FrameTimer = FrameTimer + dt
if FrameTimer >= FrameDuration then
FrameTimer = 0
FrameIndex = FrameIndex + 1
if FrameIndex > #Frames then
FrameIndex = 1
end
FrameEnabled = Frames[FrameIndex]
end
So the timer is counting, i do understand that. It's just a variable, that is counting. But how does the FrameDuration work? It's not a function, it is a variable, too. So how does the interpreter know, what that means? Okay, the FrameTimer gets set to zero, when the FrameDuration is over, i understand that, too. And i think, i understand, how the FrameIndex works. So the FrameDuration is just a numerical value? What does the "#Frames" mean? Does the "#" mean "ignore the first character"? So the value of the frame?