Animations in Love.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Garb
Prole
Posts: 29
Joined: Fri Aug 05, 2011 8:47 pm

Animations in Love.

Post by Garb »

So, I am trying to create a simple game with love, I would like to include animations in this game, unfortunately, the tutorial on the wiki for AnAl does not seem to want to work for me.

I am not exactly sure how to get animations working in Love, does anyone have any sort of detailed resources or examples I could utilize? I would love you forever if you were able to help me, thanks! :awesome:
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Animations in Love.

Post by Robin »

To animate something in LÖVE, you can either use a lot of images, one for each frame, or a single picture, which has all the frames next to each other.

You can use Quads to pick one portion of the image at the time and draw it.

Those are the basics. What sort of resources would you like to see? Tutorials, or animations used in actual games?
Help us help you: attach a .love.
Garb
Prole
Posts: 29
Joined: Fri Aug 05, 2011 8:47 pm

Re: Animations in Love.

Post by Garb »

I would love to get some sort of sprite-sheet tutorial for animation in love if anyone has a good one.
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: Animations in Love.

Post by thelinx »

Here's something I made for someone in IRC a while back. It might help.
Attachments
animation.love
(5.91 KiB) Downloaded 26369 times
User avatar
Ellohir
Party member
Posts: 235
Joined: Sat Oct 22, 2011 11:12 pm

Re: Animations in Love.

Post by Ellohir »

What a bummer expecting an animation and seeing a static blank square :cry: #PO2problems #firstWorldProblems
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Animations in Love.

Post by bartbes »

But an animated blank square!
Garb
Prole
Posts: 29
Joined: Fri Aug 05, 2011 8:47 pm

Re: Animations in Love.

Post by Garb »

thelinx wrote:Here's something I made for someone in IRC a while back. It might help.
Thanks bro, this is going to help some much.

You are on my imaginary list of totally awesome people. :awesome:
User avatar
Kazagha
Prole
Posts: 40
Joined: Tue Oct 04, 2011 7:05 am

Re: Animations in Love.

Post by Kazagha »

I have been wondering how to do a timer of sorts (and animation), very cool.

-Kazagha
User avatar
rhezalouis
Party member
Posts: 100
Joined: Mon Dec 07, 2009 10:27 am
Location: Indonesia
Contact:

[Response]Bartbes's AnimationLibrary Usage Sample

Post by rhezalouis »

Hi Garb,

You could take a look at the minimum usage of bartbes's AnimationLibrary (sounds so wrong if typed as is, doesn't it? Guys, please stop making lewd library names; parents would forbid their kids to code on löve .. )
Garb-Animation.love
LÖVE0.7.2
(6.17 KiB) Downloaded 757 times
And one with a bit more twist:
Garb-Animation2.love
LÖVE0.7.2
(6.32 KiB) Downloaded 586 times
I hope they could help you pick up the library. Enjoy.

Note: sprites are borrowed from Advance Wars (Copyright belongs to Intelligent Systems I suppose).
Aargh, I am wasting my posts! My citizenshiiiip... :o
User avatar
BEANSFTW
Prole
Posts: 28
Joined: Sun Apr 15, 2012 2:58 pm

Re: Animations in Love.

Post by BEANSFTW »

I saw the garb animation thing, and coded an animation myself and this is how it looks like.

Code: Select all

function love.load()
	require(anal)
	spritesheet = love.graphics.newImage("animationtest.png")
	spritesheet.setFilter("nearest", "nearest")
	animation = newAnimation(spritesheet, 20, 20, 5, 4)
end

function love.update(dt)
	animation:update(dt)
end

function love.draw
	animation:draw(20, 20, 0, 5)
end
and got this

Code: Select all

Syntax error: main.lua:15:'(' expected near 'animation'

Traceback

[C]: ?
[C]: in function 'require'
[C]: in function 'xpcall'
Whats wrong with my code?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 42 guests