kudoLib (LÖVE Library)

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Kuromeku
Party member
Posts: 166
Joined: Sun Jul 20, 2008 5:45 pm

kudoLib (LÖVE Library)

Post by Kuromeku »

Image

So I'm going to be adding some useful little libraries here, free to use obviously. Please keep checking this page because I will add more libraries to it and then eventually compile it into one big library (kudoLib).

Image

Name: Timer Library.
Version: 1.01.
Download: http://kudomiku.com/projects/love/kudol ... _timer.lua.
Functions:

Code: Select all

kudolib.timer:new(delay, repeats, callback);
kudolib.timer.class:run();
kudolib.timer.class:pause();
kudolib.timer.class:reset();
Example:

Code: Select all

myScore = 0;
myTimer = kudolib.timer:new(5, 0, function()
	myScore = myScore + 1;
	
	-- Check to see if we've reached the maximum score.
	if (myScore == 10) then myTimer:pause(); end;
end);
Instructions:

Call the following function in LÖVE's update callback.

Code: Select all

kudolib.timer.update();
Image

Name: Vector Library.
Version: 1.0.
Download: http://kudomiku.com/projects/love/kudol ... vector.lua.
Functions:

Code: Select all

kudolib.vector:new(x, y);
kudolib.vector.class:length();
kudolib.vector.class:dotProduct(vector);
kudolib.vector.class:distance(vector);
kudolib.vector.class:angle();
kudolib.vector.class:rotateAround(vector, angle);
kudolib.vector.class:normalize();
kudolib.vector.class.__add(a, b);
kudolib.vector.class.__unm(a);
kudolib.vector.class.__sub(a, b);
kudolib.vector.class.__mul(a, b);
kudolib.vector.class.__div(a, b);
kudolib.vector.class.__eq(a, b);
kudolib.vector.class.__tostring(a);
Example:

Code: Select all

myVector1 = kudolib.vector:new(512, 512);
myVector2 = kudolib.vector:new(128, 128);

-- Add the vectors together and normalise the result.
myVector3 = (myVector1 + myVector 2):normalize();

-- Print the new normalised vector.
print(myVector3);
Last edited by Kuromeku on Wed Sep 10, 2008 7:38 am, edited 2 times in total.
SnakeFace
Prole
Posts: 28
Joined: Tue Aug 19, 2008 2:45 pm

Re: kudoLib (LÖVE Library)

Post by SnakeFace »

Do you mind if I make my own games libraries based off of the timer one?
Lovely quotes
somewhere within the jungle of administrative doom - rude
User avatar
Kuromeku
Party member
Posts: 166
Joined: Sun Jul 20, 2008 5:45 pm

Re: kudoLib (LÖVE Library)

Post by Kuromeku »

What do you mean? I only want my name credited somewhere that's all.

-- Based off kudoLib.

or

-- Thanks to kudoLib and Kudomiku.

or some shit.

And I just updated the timer library. I forgot something so now it should work.
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: kudoLib (LÖVE Library)

Post by rude »

^-^)/ Nice! What kind of libraries do you plan to make?
User avatar
Kuromeku
Party member
Posts: 166
Joined: Sun Jul 20, 2008 5:45 pm

Re: kudoLib (LÖVE Library)

Post by Kuromeku »

Whatever anybody wants really, or what I deem useful! :)

Any ideas Rude?
User avatar
conman420
Prole
Posts: 33
Joined: Sun Aug 31, 2008 8:46 pm

Re: kudoLib (LÖVE Library)

Post by conman420 »

A vector library?

Like getting angles between 2 points etc.

I know it can be done without a library but it would be nice to have for convenience.
User avatar
Kuromeku
Party member
Posts: 166
Joined: Sun Jul 20, 2008 5:45 pm

Re: kudoLib (LÖVE Library)

Post by Kuromeku »

Basic Vector library added. Will add more advanced functions later.
User avatar
Nexion
Prole
Posts: 46
Joined: Fri Sep 05, 2008 1:40 pm

Re: kudoLib (LÖVE Library)

Post by Nexion »

Where do we add the libraries in, and I can't remember the Lua line to include a file.
User avatar
Kaze
Party member
Posts: 189
Joined: Sat Jul 19, 2008 4:39 pm
Location: Dublin, Ireland

Re: kudoLib (LÖVE Library)

Post by Kaze »

Nexion wrote:Where do we add the libraries in, and I can't remember the Lua line to include a file.
Put the libraries in your game folder/zip.
love.filesystem.include is the function to include a file. love.filesystem.include("kudolib_timer.lua") etc
SnakeFace
Prole
Posts: 28
Joined: Tue Aug 19, 2008 2:45 pm

Re: kudoLib (LÖVE Library)

Post by SnakeFace »

An extensive rounding library would be nice.
Lovely quotes
somewhere within the jungle of administrative doom - rude
Post Reply

Who is online

Users browsing this forum: No registered users and 94 guests