[SOLVED] No gravity?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
CrackedP0t
Citizen
Posts: 69
Joined: Wed May 07, 2014 4:01 am
Contact:

[SOLVED] No gravity?

Post by CrackedP0t » Wed Jun 04, 2014 1:07 am

When I try to use this code, it doesn't pull down the shapes. Why?

Code: Select all

---------------------------
function love.load()
	love.window.setTitle("Physics Toy")
	objects = {}
	love.physics.setMeter(64)
	world = love.physics.newWorld(0, 85, true)
end

---------------------------
function love.update(dt)

end

---------------------------
function love.draw()
	for i, object in ipairs(objects) do
		love.graphics.polygon("fill", object.body:getWorldPoints(object.shape:getPoints()))
	end
end

---------------------------
function love.mousepressed(x, y, button)
	if button=="l" then
		local width = 100
		local height = 175
		local newobject = {}
		newobject.body = love.physics.newBody(world, x, y, "dynamic")
		newobject.shape = love.physics.newRectangleShape(width, height)
		newobject.fixture = love.physics.newFixture(newobject.body, newobject.shape, 5)
		table.insert(objects, newobject)
	end
end
Edit --
Wait. world:update(dt).
:awesome:
Last edited by CrackedP0t on Wed Jun 04, 2014 3:42 am, edited 1 time in total.
/人 ◕‿‿◕ 人\
Here, have an umlaut. Ö

User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: No gravity?

Post by substitute541 » Wed Jun 04, 2014 3:00 am

... I think it's really obvious.




Well, if you already solved it yourself, you should add a [SOLVED] tag to the title of your post.
Currently designing themes for WordPress.

Sometimes lurks around the forum.

Post Reply

Who is online

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