physics - a simple love2d physics library

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Doctory
Party member
Posts: 441
Joined: Fri Dec 27, 2013 4:53 pm

physics - a simple love2d physics library

Post by Doctory »

I've been trying to make a library to make love.physics easier, so far so good.
It currently only supports circle objects and rectangle objects (bummer :huh:)
A world is already created upon using the library.

Usage:

Circle:

Code: Select all

physics.newCircleObject(x, y, body, name, size, density, restitution)

@param: x: x position of the circle object
@param: y: y position of the circle object
@param: body: body type of the circle object (ex. "dynamic")
@param: name: name of the circle object (used to draw the object)
@param: size: size of the circle object
@param: density: density of the circle object
@param: restitution: restitution of the circle object (bounciness)

@returns: new circle object
==--------------------------------------------------==

Rectangle:

Code: Select all

physics.newRectangleObject(x, y, body, name, size1, size2, density, restitution)

@param: x: x position of the rectangle object
@param: y: y position of the rectangle object
@param: body: body type of the rectangle object (ex. "dynamic")
@param: name: name of the rectangle object (used to draw the object)
@param: size1: size 1 of the rectangle object
@param: size2: size 2 of the rectangle object
@param: density: density of the rectangle object
@param: restitution: restitution of the rectangle object (bounciness)

@returns: new rectangle object
==--------------------------------------------------==

Draw circle:

Code: Select all

physics.drawCircleObject(mode, name, r, g, b)

@param: mode: how to draw the circle object (ex. "line")
@param: name: name of which circle object to draw
@param: r: red color code
@param: g: green color code
@param: b: blue color code
==--------------------------------------------------==

Draw rectangle:

Code: Select all

physics.drawRectangleObject(mode, name, r, g, b)

@param: mode: how to draw the rectangle object (ex. "line")
@param: name: name of which rectangle object to draw
@param: r: red color code
@param: g: green color code
@param: b: blue color code
I hope someone finds this useful. I do.

==--------------------------------------------------==
Attachments
physics.lua
(2.77 KiB) Downloaded 95 times
Post Reply

Who is online

Users browsing this forum: No registered users and 65 guests