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)
AnAL Animation problems
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: AnAL Animation problems
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:
to the end of your update function.
Code: Select all
player.anim:update(dt)
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: AnAL Animation problems
RiiightMerlin_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:
to the end of your update function.Code: Select all
player.anim:update(dt)
Totaly forgot about this, thanks Merlin
And welcome to the forum
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests