Re: Lope2D [Love2D Physics Engine]
Posted: Mon Feb 17, 2014 7:51 pm
Nice
I'm going to make something similar.
I'm going to make something similar.
Done! Thank you.T-Bone wrote:Seems like a nice library. It doesn't really matter, but wouldn't it be better if you defined a single "lope" table instead of having lots of functions called "lope_x", like love does? So lope_drawWorld becomes lope.drawWorld. The benefits of this include having less globals and the option of easily changing the name of the entire table.
Code: Select all
require "lope2d"
function love.load()
gr = love.graphics
gr.setColor(255, 127, 0)
gr.setLineStyle("rough")
r = love.math.random
w = gr.getWidth()
h = gr.getHeight()
floor = lope.newBody("static", "rectangle", w / 2, h - 25, w, 50)
lw = lope.newBody("static", "rectangle", 25, h / 2, 25, h)
rw = lope.newBody("static", "rectangle", w - 25, h / 2, 25, h)
ceiling = lope.newBody("static", "rectangle", w / 2, 25, w, 50)
poly = lope.newBody("dynamic", "rectangle", 200, 200, 50, 50)
bodies = {
lw,
rw,
floor,
ceiling,
poly
}
pts = {}
end
function love.update(dt)
lope.update(dt)
end
function love.draw()
--lope.draw(bodies, "fill")
lope.draw(bodies, "line")
end
Ok, so I made some changes to lope2d.lua to actually support Polygons, no tested with images and the water pools, just the fill mode.Hi ilgamer, any support for polygons in Lope2D?
Code: Select all
vertices = {
{x = 194, y = 166},
{x = 208, y = 149},
{x = 243, y = 150},
{x = 344, y = 232},
{x = 301, y = 283},
{x = 218, y = 314},
{x = 160, y = 308}
}
poly = lope.newBody("dynamic", "polygon", vertices)
Thanks for the note!EntranceJew wrote:A good alternative to a simpler love.physics API would be hxdx although it has a few bugs that I've encountered.