Hello, I'm a artist/animator hobbyist. I have been using flash and flex library's for quite a while now. While flash is a great animators tool it lacks in performance when large objects are present on the stage, that kinda sucks when I'm trying to develop a fully vector based platformer.
So I was thinking of making the jump to lua, and Löve. Now what kind of features/methods does it have when it comes to animation and creating large stages with big images present?
EDIT: Oh yea, I should probably specify the type of animation. I'm thinking frame by frame, image-based.
...just read the forum rules "read this", man i suck at forums.
Animation/Löve specs
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Trappingnoobs
- Citizen
- Posts: 95
- Joined: Tue Oct 12, 2010 8:52 pm
Re: Animation/Löve specs
It's not hard to make on from a spritesheet, just a little math and trial and error realy.Figment wrote:Hello, I'm a artist/animator hobbyist. I have been using flash and flex library's for quite a while now. While flash is a great animators tool it lacks in performance when large objects are present on the stage, that kinda sucks when I'm trying to develop a fully vector based platformer.
So I was thinking of making the jump to lua, and Löve. Now what kind of features/methods does it have when it comes to animation and creating large stages with big images present?
EDIT: Oh yea, I should probably specify the type of animation. I'm thinking frame by frame, image-based.
...just read the forum rules "read this", man i suck at forums.
Re: Animation/Löve specs
Got any videos/text tutorials on this so I can get a closer look at the process?It's not hard to make on from a sprite sheet, just a little math and trial and error really.
To see if it looks similar to any of my other work environments.
- Trappingnoobs
- Citizen
- Posts: 95
- Joined: Tue Oct 12, 2010 8:52 pm
Re: Animation/Löve specs
This'll only work for my class system, unless somone made a similar one, but here's my implementation. The first code block is for spritesheets, the second you just pass in an array of sprites. It's a bit rough and could be improved;Figment wrote:Got any videos/text tutorials on this so I can get a closer look at the process?It's not hard to make on from a sprite sheet, just a little math and trial and error really.
To see if it looks familiar to any of my other work environments.
Code: Select all
Class "spritesheetAnimation" {
image,
cellWidth,
cellHeight,
["current"] = 1,
["framesPerUpdate"] = 5,
["maxFramesPerUpdate"] = 5,
["quads"] = {},
["parseSheet"] = function(s,Img,cw,ch)
s.cellWidth = cw
s.cellHeight = ch
s.image = Img
local amX = Img:getWidth()/cw
local amY = Img:getHeight()/ch
for y = 0, amY*ch-ch, ch do
for x = 0, amX*cw-cw, cw do
table.insert(s.quads, love.graphics.newQuad(x,y,cw,ch,Img:getWidth(),Img:getHeight()))
end
end
end,
["setFrames"] = function(s,fr)
s.framesPerUpdate = fr
s.maxFramesPerUpdate = fr
end,
["draw"] = function(s,x,y,w,h)
local lq = s.quads[s.current]
local w, h = w/s.cellWidth, h/s.cellHeight
love.graphics.drawq(s.image,lq,x,y,0,w,h)
love.graphics.print(s.current, 50,150,0,1,1)
end,
["update"] = function(s)
s.framesPerUpdate = s.framesPerUpdate - 1
if s.framesPerUpdate < 0 then
s.framesPerUpdate = s.maxFramesPerUpdate
s.current = s.current + 1
if s.current > #s.quads then
s.current = 1
end
end
end,
}
Code: Select all
Class "animation" {
["imageList"] = {},
["add"] = function(s,Img)
table.insert(s.imageList,Img)
end,
["current"] = 1,
["framesPerUpdate"] = 5,
["maxFramesPerUpdate"] = 5,
["setFrames"] = function(s,fr)
s.framesPerUpdate = fr
s.maxFramesPerUpdate = fr
end,
["draw"] = function(s,x,y,w,h)
local im = s.imageList[current]
if h then
local w = w/im:getWidth() --Fix scale so we can draw via pixels
local h = h/im:getHeight()
else
local h,w = im:getHeight(), im:getWidth()
end
love.graphics.draw(im,x,y,0,w,h)
end,
["update"] = function(s)
s.framesPerUpdate = s.framesPerUpdate - 1
if s.framesPerUpdate > 0 then
s.framesPerUpdate = s.maxFramesPerUpdate
s.current = s.current + 1
if s.current > #s.imageList then
s.current = 1
end
end
end,
}
Re: Animation/Löve specs
Thanks! wow that code looks messy
Guess I got some work to do.
Guess I got some work to do.
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: Animation/Löve specs
You could take a look at AnAL for a fairly simple animation implementation.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Animation/Löve specs
@Trappingnoobs, you are frightening the new guy.
@Figment: the LÖVE core doesn't come with any built-in help for making animations; just for making quads out of an image, and displaying them (like with sprites).
However! There's a Lua-implemented lib called AnAL that builds on top of that functionality and offers animations.
Also, please note that Trappingnoob is only displaying how he does things. He's forgotten to mention that he's using an object-oriented library, which is not part of LÖVE or Lua.
And yes, his code is a bit messy
Edit: ninja'd by nevon
@Figment: the LÖVE core doesn't come with any built-in help for making animations; just for making quads out of an image, and displaying them (like with sprites).
However! There's a Lua-implemented lib called AnAL that builds on top of that functionality and offers animations.
Also, please note that Trappingnoob is only displaying how he does things. He's forgotten to mention that he's using an object-oriented library, which is not part of LÖVE or Lua.
And yes, his code is a bit messy
Edit: ninja'd by nevon
When I write def I mean function.
Re: Animation/Löve specs
.. AnAL Love? This just gets better and better lawl.
Anyway I found this great "swf to sprite sheet" converter, if anyone is interested: http://easeljs.com/zoe.html
How well does it handle large sheets? I played a couple games which featured some fairly large graphics and it was lagging pretty badly.(my computer specs are above average)
is it possible to remove that witch is not shown on the "main stage" then add it when needed? In ex. scrolling games.
oh one more thing, do any potential players need to download löve to play the end product .löve files?
Anyway I found this great "swf to sprite sheet" converter, if anyone is interested: http://easeljs.com/zoe.html
How well does it handle large sheets? I played a couple games which featured some fairly large graphics and it was lagging pretty badly.(my computer specs are above average)
is it possible to remove that witch is not shown on the "main stage" then add it when needed? In ex. scrolling games.
oh one more thing, do any potential players need to download löve to play the end product .löve files?
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Animation/Löve specs
As far as I know, LÖVE's policy is basically "give as much work as possible to the graphics card". I believe that includes handling sheets; but I'm not sure. If that was the case, a file with large spritesheets would run just fine in some computers and not at all in others.Figment wrote:How well does it handle large sheets? I played a couple games which featured some fairly large graphics and it was lagging pretty badly.(my computer specs are above average)
Also, regarding the size, read this: PO2_Syndrome
LÖVE doesn't have an "automatic image splitter", if that's what you are asking. If you want to present, say, a 400000x400000px background, the best way to do that would be splitting the background into smaller images. LÖVE doesn't do the "splitting" automatically for you.Figment wrote:is it possible to remove that witch is not shown on the "main stage" then add it when needed? In ex. scrolling games.
.love files can be "attached" to the love.exe executable so the final game looks like a regular exe file; or so I've heard - I've never tried that myself.Figment wrote:oh one more thing, do any potential players need to download löve to play the end product .löve files?
Last edited by kikito on Sun Aug 07, 2011 12:46 pm, edited 1 time in total.
When I write def I mean function.
Re: Animation/Löve specs
Thanks everybody, this has been most informative.
I will be messing around with it once I have dug a little deeper into lua.
I will be messing around with it once I have dug a little deeper into lua.
Who is online
Users browsing this forum: Amazon [Bot], Google [Bot] and 13 guests