Page 1 of 1

AnAL Animation problems

Posted: Sat Jul 13, 2013 2:57 pm
by Ranguna259
Hello again lovers

I've found out that I can't use löve's physics to code the player so I've decided to re-write player.lua without them.

The problem is that I can't get the animation to play all the frames.

When the rectangle falls to the ground and when you press 'a' or 'd' then the player should move right or left (it does) and it should also play the walking animation, player.anim, which was built with a 3 frame image called 'walking.png' in the lines 31 and 32 but when the animation playes it only shows 1 frame.

I want to know what I am doing wrong with the animation and how to correct it.

Thanks for reading, I've attached a .love file with a main.lua and all the images.

(the animation is loaded in the lines 31 and 32 and it's played in the line 137)

Re: AnAL Animation problems

Posted: Sun Jul 14, 2013 1:04 am
by Merlin_ua
You need to call "update" for the animation, not just "draw". Currently it never moves on from the first frame. This can be fixed by simply adding:

Code: Select all

player.anim:update(dt)
to the end of your update function.

Re: AnAL Animation problems

Posted: Sun Jul 14, 2013 10:39 am
by Ranguna259
Merlin_ua wrote:You need to call "update" for the animation, not just "draw". Currently it never moves on from the first frame. This can be fixed by simply adding:

Code: Select all

player.anim:update(dt)
to the end of your update function.
Riiight :megagrin:

Totaly forgot about this, thanks Merlin

And welcome to the forum :)