PicoPicoGameEngine

Quick Links

Source Code

world=b2World.new(0,-10)
world:drawScale(10,-10)
groundBody=world:createBody()

shape=b2Shape.edge()
shape:set(-40,0,40,0)
ground=world:createBody()
ground:createFixture(shape)

restitution = {0.0,
               0.1,
               0.3,
               0.5,
               0.75,
               0.9,
               1.0}

for i=0,6 do
  shape=b2Shape.circle(
    {density=1,
     restitution=restitution[i+1]})
  shape.radius=1
  body=world:createBody(
             "dynamic",{-10+3*i,20})
  body:createFixture(shape)
end

world:shiftOrigin(-17,30)

function start()
  world:debugDrag(pptouch())
  world:step()
  world:debugDrawBody()
  world:debugDrawJoint()
end