I'm making a platformer and I have a character comprised of 3 animated parts: arm, body, face. The frames for the animations of each part are in their own spritesheets and are animated using AnAL. I'm not sure how to mirror the animations when turning from left to right (the textures face left), and I'm not sure how to change from the idle animations to the walking animations. All of the tutorials and threads I've seen so far use drawn images (using löve's draw function) and aren't animated or are animated using something other than AnAL.
For the walking / idle animation switch, I've tried stopping the idle animation and starting the walking one under the love.keyboard.isDown, but that just stopped the idle animation even when the button wasn't down and when the button was down, the new one didn't start. A similar thing happened with love.keypressed.
Download:https://dl.dropboxusercontent.com/u/116 ... rySP5.love
Thanks in advance
[Solved]How to mirror an AnAL animation
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[Solved]How to mirror an AnAL animation
Last edited by zooks97 on Sat Jan 04, 2014 4:01 pm, edited 1 time in total.
- OmarShehata
- Party member
- Posts: 259
- Joined: Tue May 29, 2012 6:46 pm
- Location: Egypt
- Contact:
Re: How to mirror an AnAL animation
You're already drawing the "stand" animation, and commenting out the walking one. And if you comment out the stand, and leave the walking, then the character walks, right?
So all I did was make a variable "walking", which is set to false every frame, and if either the right or left key is pressed, it gets set to true. Here's the edited main.lua: http://pastebin.com/zySvcFzN
As for flipping the animation, you said that every tutorial and thread you've seen using love's normal draw functions, not AnAL's, but there's virtually no difference.
This is the draw function in AnAL.lua
So all it really does is take whatever arguments you give it and passes it to the draw function. You're drawing your objects by draw(x,y), you can add draw(x,y,angle,scaleX,scaleY) and so on. Adding a negative scaleX will flip the animations.
So all I did was make a variable "walking", which is set to false every frame, and if either the right or left key is pressed, it gets set to true. Here's the edited main.lua: http://pastebin.com/zySvcFzN
As for flipping the animation, you said that every tutorial and thread you've seen using love's normal draw functions, not AnAL's, but there's virtually no difference.
This is the draw function in AnAL.lua
Code: Select all
--- Draw the animation
local drawq = love.graphics.drawq or love.graphics.draw
function animation:draw(...)
return drawq(self.img, self.frames[self.position], ...)
end
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: How to mirror an AnAL animation
AnAL is not comptible with 0.9.0 anymore, right ?
I haven't had the time to test it in the new version but if it's not compatible then I'm going to have a hard time with my old animation codes.
I haven't had the time to test it in the new version but if it's not compatible then I'm going to have a hard time with my old animation codes.
Re: How to mirror an AnAL animation
Yes, it does work in 0.9.x; that's what I'm using it in.
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: [Solved]How to mirror an AnAL animation
Awesome, I thought it used some kind of quad technique to sort the frames in the animations.
Thanks for the info
Thanks for the info
Who is online
Users browsing this forum: No registered users and 2 guests