Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
New ChainShape — Gideros Forum

New ChainShape

ar2rsawseenar2rsawseen Maintainer
edited March 2012 in Code snippets
Just love new ChainShape.
Creating world boundaries now is as simple as:
local body = world:createBody{type = b2.STATIC_BODY}
body:setPosition(0, 0)
local chain = b2.ChainShape.new()
chain:createLoop(
	0,0,
	application:getContentWidth(), 0,
	application:getContentWidth(), application:getContentHeight(),
	0, application:getContentHeight()
)
local fixture = body:createFixture{shape = chain, density = 1.0, 
friction = 1, restitution = 0.3}
And you can easily extend it to more complex terrain.
Just love it.
+1 -1 (+3 / -0 )Share on Facebook

Comments

Sign In or Register to comment.