Difference between revisions of "newton"
Line 1: | Line 1: | ||
Use the tools in this library to export Box2D bodies created using PhysicsEditor and load them into your LÖVE game. | Use the tools in this library to export Box2D bodies created using PhysicsEditor and load them into your LÖVE game. | ||
+ | |||
+ | '''Usage example:''' | ||
+ | <source lang="lua"> | ||
+ | local loader = require "loader" | ||
+ | local wdraw = require "wdraw" | ||
+ | local world = love.physics.newWorld() | ||
+ | local body | ||
+ | local x, y = 100, 100 | ||
+ | |||
+ | function love.load() | ||
+ | body = loader(world, "physics/exportedFile", "bodyName", x, y) | ||
+ | end | ||
+ | |||
+ | function love.update(dt) | ||
+ | world:update(dt) | ||
+ | end | ||
+ | |||
+ | function love.draw() | ||
+ | wdraw(world) | ||
+ | end | ||
+ | </source> | ||
+ | |||
== Links == | == Links == | ||
*[https://bitbucket.org/tcadamson/love2d-physicseditor-library Bitbucket repo] | *[https://bitbucket.org/tcadamson/love2d-physicseditor-library Bitbucket repo] |
Revision as of 05:13, 21 February 2017
Use the tools in this library to export Box2D bodies created using PhysicsEditor and load them into your LÖVE game.
Usage example:
local loader = require "loader"
local wdraw = require "wdraw"
local world = love.physics.newWorld()
local body
local x, y = 100, 100
function love.load()
body = loader(world, "physics/exportedFile", "bodyName", x, y)
end
function love.update(dt)
world:update(dt)
end
function love.draw()
wdraw(world)
end