[Library] anim8 - An animation library - v2.3.0 released
Re: [Library] anim8 - An animation library - v2.1.0 released
Ah, thank you kikito, I finally get it. Honestly I prefer to put in the coordinates in manually, rather than using your string shortcut, but it is a nice feature once you get used to it. Thanks again for the work you put in to all your wonderful libraries, you make the best ones.
Re: [Library] anim8 - An animation library - v2.1.0 released
I think it would be nice if every (x, y) pair would be one string:
"1, 2"
"2-3, 2"
"5, 4-7"
"2-3, 9-10"
then dealing with the varargs would get easier in trade for slightly more complex parsing (split at comma, tonumber() if theres no dash).
I think that looks a lot cleaner, mixing strings and numbers always felst (slightly) dirty for some reason.
"1, 2"
"2-3, 2"
"5, 4-7"
"2-3, 9-10"
then dealing with the varargs would get easier in trade for slightly more complex parsing (split at comma, tonumber() if theres no dash).
I think that looks a lot cleaner, mixing strings and numbers always felst (slightly) dirty for some reason.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: [Library] anim8 - An animation library - v2.1.0 released
It was like that initially, but I removed it later on. Almost always it's the same amount of characters, and it simplifies the parsing quite a lot.
When I write def I mean function.
Re: [Library] anim8 - An animation library - v2.1.0 released
Hello.
What would be the approach to accomplish the following:
I have a button and a sprite with two movements. The attack movement and the idle movement. The sprite is always being animated with the idle movement. When I click the button, I want to change the animation to the attack one and when finishing the attack, return to the idle animation.
Also, is possible to get the exact moment of the end of the attack to trigger another event?
Thanks for any answer, I'm really new into Löve and Lua.
What would be the approach to accomplish the following:
I have a button and a sprite with two movements. The attack movement and the idle movement. The sprite is always being animated with the idle movement. When I click the button, I want to change the animation to the attack one and when finishing the attack, return to the idle animation.
Also, is possible to get the exact moment of the end of the attack to trigger another event?
Thanks for any answer, I'm really new into Löve and Lua.
Re: [Library] anim8 - An animation library - v2.1.0 released
For the end of the attack, you can put an "onLoop" function:SouL wrote:Hello.
What would be the approach to accomplish the following:
I have a button and a sprite with two movements. The attack movement and the idle movement. The sprite is always being animated with the idle movement. When I click the button, I want to change the animation to the attack one and when finishing the attack, return to the idle animation.
Also, is possible to get the exact moment of the end of the attack to trigger another event?
Thanks for any answer, I'm really new into Löve and Lua.
Code: Select all
animation.onLoop = function () -- do something end
Code: Select all
function Player.new()
local self = {} -- whatever you are doing here
self.idle = IDLE_ANIM:clone() -- the anim8 idle animation
self.attack = ATTACK_ANIM:clone()
self.attack.onLoop = function () self:attackDone() end
self.anim = self.idle
return self
end
function Player:update(dt)
self.anim:update(dt)
if not self.attacking and love.keyboard.isDown" " then
self.attacking = true
self.anim = self.attack
end
end
function Player:draw()
self.anim:draw()
end
function Player:attackDone()
-- do something
end
-
- Party member
- Posts: 730
- Joined: Sat Apr 26, 2014 7:46 pm
Re: [Library] anim8 - An animation library - v2.1.0 released
Does anim8 support spritebatches?
Edit: If it doesn't I could add that in this weekend and submit a PR. Although the api probably would have to be changed to reflect that.
Edit: If it doesn't I could add that in this weekend and submit a PR. Although the api probably would have to be changed to reflect that.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: [Library] anim8 - An animation library - v2.1.0 released
I am releasing anim8 v 2.3.0 today!
It adds a couple things:
* spritebatch support (thanks to bobbyjones and zorggn for their invaluable feedback in resolving this)
* better handling of the shear factor params (kx,ky) when drawing / blitting to a spritebatch
I have also written a small demo showing spritebatches and shearing working together. It can be found on the spritebatch-demo branch: https://github.com/kikito/anim8/tree/spritebatch-demo
It adds a couple things:
* spritebatch support (thanks to bobbyjones and zorggn for their invaluable feedback in resolving this)
* better handling of the shear factor params (kx,ky) when drawing / blitting to a spritebatch
I have also written a small demo showing spritebatches and shearing working together. It can be found on the spritebatch-demo branch: https://github.com/kikito/anim8/tree/spritebatch-demo
When I write def I mean function.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: [Library] anim8 - An animation library - v2.3.0 released
In all honesty, you did most of the work, so thanks to you, kikito!
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
-
- Party member
- Posts: 730
- Joined: Sat Apr 26, 2014 7:46 pm
Re: [Library] anim8 - An animation library - v2.3.0 released
Yay, but as zorg said, I did nothing but complain lol.
edit: 500th post \o/
edit: 500th post \o/
- Jack Dandy
- Prole
- Posts: 49
- Joined: Mon Sep 08, 2014 4:26 pm
Re: [Library] anim8 - An animation library - v2.3.0 released
Hey there, first off- THANKS very much for this cool, handy library!
Now, I have a question.
In the readme in https://github.com/kikito/anim8, it says:
But I don't exactly understand, how am I supposed to access the two parameters you talked about in the quote?
For example, the following didn't work.
Now, I have a question.
In the readme in https://github.com/kikito/anim8, it says:
Now, let's say I supply my own little function.onLoop is an optional parameter which can be a function or a string representing one of the animation methods. It does nothing by default. If specified, it will be called every time an animation "loops". It will have two parameters: the animation instance, and how many loops have been elapsed. The most usual value (apart from none) is the string 'pauseAtEnd'. It will make the animation loop once and then pause and stop on the last frame.
But I don't exactly understand, how am I supposed to access the two parameters you talked about in the quote?
For example, the following didn't work.
Code: Select all
slashAnim = anim8.newAnimation(animgrid('1-6',1), 0.04, (function(a,b) DRAWSLASH=false a:pauseAtEnd() end))
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests