Fling: a library

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Fling: a library

Post by Robin » Sat Aug 15, 2009 8:18 pm

I was recently thinking about a LÖVE plug-in for Firefox. I decided that it is something that could be done, but not by me. However, that got me thinking about Flash (because, well, I don't really need to explain that, do I?), and thus was Fling born: a FLash INspired Graphics library. It's still in it's infancy, so it might change radically, and you can't do a lot with it (run the .love file to see what is).

I think the LPCL is appropriate here.

See latest post for new version.
Attachments
flingtest.love
(2.09 KiB) Downloaded 217 times
Last edited by Robin on Thu Sep 10, 2009 3:34 pm, edited 1 time in total.
Help us help you: attach a .love.

User avatar
Tenoch
Citizen
Posts: 76
Joined: Mon Jul 21, 2008 7:49 am

Re: Fling: a library

Post by Tenoch » Sun Aug 16, 2009 1:58 am

Interesting, this way of scripting the animation once, and letting the engine doing the rest. I'm not sure how interactive this can be made. More for cutscenes or something like that perhaps?
"When in doubt, use brute force." Ken Thompson

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Fling: a library

Post by TechnoCat » Sun Aug 16, 2009 3:00 am

I really like this idea. Sometimes you just want a scripted animation in your menus that don't necessarily need to be adaptable to anything.

User avatar
bartbes
Sex machine
Posts: 4944
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Fling: a library

Post by bartbes » Sun Aug 16, 2009 7:35 am

That looks great, though you might want to move

Code: Select all

update = fling.update
draw = fling.draw
out of fling, and into the main.lua. Another thing, is there a way to draw a single animated image? Like fling.draw(img1)?

User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Fling: a library

Post by Robin » Sun Aug 16, 2009 9:17 am

bartbes wrote:That looks great, though you might want to move

Code: Select all

update = fling.update
draw = fling.draw
out of fling, and into the main.lua.
Why? I added those two lines so it would use fling.update() and fling.draw() if no update() and draw() were defined. That way, any .love using Fling would be an animation by default, unless they added some interactive code by themselves.

For the record, fling.update() and fling.draw() can be used for animating cutscenes and the like:

Code: Select all

function update(dt)
    if cutscene then
        fling.update(dt)
        if #fling.queue == 0 then cutscene = false end
    else
        -- all the usual stuff
        if x > 100 then
            -- prepare cutscene
            cutscene = true
        end
    end
end
function draw(dt)
    if cutscene then
        fling.draw()
    else
        -- draw the usual
    end
end
bartbes wrote:Another thing, is there a way to draw a single animated image? Like fling.draw(img1)?
Good idea. I'll start implementing it right away.
Tenoch wrote:I'm not sure how interactive this can be made.
Me neither. But we'll find out along the way.
Help us help you: attach a .love.

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Fling: a library

Post by TechnoCat » Mon Aug 17, 2009 8:29 pm

I library like this needs easing in the motion.
like so: jQuery Easing Plugin (version 1.3)

User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Fling: a library

Post by Robin » Mon Aug 17, 2009 11:57 pm

TechnoCat wrote:I library like this needs easing in the motion.
like so: jQuery Easing Plugin (version 1.3)
Interesting... I think you're right. I will try to implement it.

By the way, I found this page very useful, and the pdf link in particular.
Help us help you: attach a .love.

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Fling: a library

Post by TechnoCat » Tue Aug 18, 2009 12:08 am

Robin wrote:By the way, I found this page very useful, and the pdf link in particular.
Whoa, definitely bookmarking that.

EDIT: Don't forget to check out the jQuery Easing v1.3 source.
EDIT2: That pdf was an interesting read. Almost makes it look easy. The author's humor was also appreciated by me. :megagrin:

User avatar
Pliskin09
Citizen
Posts: 89
Joined: Fri Jul 24, 2009 8:30 am

Re: Fling: a library

Post by Pliskin09 » Tue Aug 18, 2009 11:31 pm

looks very nice robin. exactly what i had in mind as well when i made a thread. i dont have the know how to do it though :p

User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Fling: a library

Post by Robin » Sun Aug 23, 2009 4:56 pm

New version!

I've implemented fling.draw(img1), started with callbacks (for example a function will be called if a certain key is pressed), and the easing functions.

Especially with the last I'm having some difficulties. I think it might be due to the way I implemented the rest of Fling.
Attachments
flingtest2.love
(2.53 KiB) Downloaded 123 times
Help us help you: attach a .love.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 8 guests