I've been trying to create a simple idle animation. It's not working. I'm relatively new to this so I have no clue what the error means but if anyone could help me that would be great!
Thanks for the help i appreciate it!
Mostly it looks like you have your THEN in the wrong place on all those lines. Where you have:
ELSE THEN IF IDLE == 30
you want
ELSEIF IDLE == 30 THEN
(note also that ELSEIF is all one word)
and your last line with ELSE THEN
should not have a THEN at all.
You don't need then
following else
, only if
and elseif
. It feels like you had the right idea but elseif
needs to be one word for the compiler to understand what you mean.
You were also missing an end
.
if idle < 15 then idle+=1 if idle == 15 then spr(81,x+50,y+50) elseif idle == 30 then idle=0 spr(65,x+50,y+50) end end |
Idle will never get to 30 here though because you're only incrementing it if its less than 15 so I'd do something like this
function _draw() idle+=1 if idle <= 15 then spr(81,x+50,y+50) elseif idle <=30 then spr(65,x+50,y+50) else idle=0 end |
[Please log in to post a comment]