Log In  

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!

Cart #supuzobujo-0 | 2023-08-16 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Thanks for the help i appreciate it!

P#133162 2023-08-16 20:42 ( Edited 2023-08-17 14:14)

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.

P#133165 2023-08-16 20:51
1

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
P#133164 2023-08-16 21:00 ( Edited 2023-08-17 13:16)

[Please log in to post a comment]