Exemplo n.º 1
0
 public PBody BindCirclePhysics(bool fix, SpriteBatchObject o,
                                float density)
 {
     if (usePhysics)
     {
         RectBox rect = o.GetRectBox();
         float   r    = (rect.width + rect.height) / 4;
         PBody   body = _manager.AddCircle(fix, o.X(), o.Y(), r,
                                           MathUtils.ToRadians(o.GetRotation()), density);
         body.SetTag(o);
         CollectionUtils.Put(_Bodys, o, body);
         return(body);
     }
     else
     {
         throw new RuntimeException("You do not set the physics engine !");
     }
 }
Exemplo n.º 2
0
 public PBody BindTexturePhysics(bool fix, SpriteBatchObject o,
                                 float density)
 {
     if (usePhysics)
     {
         PBody body = _manager.AddShape(fix, o.GetAnimation()
                                        .GetSpriteImage(), MathUtils.ToRadians(o.GetRotation()),
                                        density);
         if (body.Size() > 0)
         {
             body.Inner_shapes()[0].SetPosition(o.X() / _manager.scale,
                                                o.Y() / _manager.scale);
         }
         body.SetTag(o);
         CollectionUtils.Put(_Bodys, o, body);
         return(body);
     }
     else
     {
         throw new RuntimeException("You do not set the physics engine !");
     }
 }
Exemplo n.º 3
0
 public PBody BindTexturePhysics(bool fix, SpriteBatchObject o,
         float density)
 {
     if (usePhysics)
     {
         PBody body = _manager.AddShape(fix, o.GetAnimation()
                 .GetSpriteImage(), MathUtils.ToRadians(o.GetRotation()),
                 density);
         if (body.Size() > 0)
         {
             body.Inner_shapes()[0].SetPosition(o.X() / _manager.scale,
                     o.Y() / _manager.scale);
         }
         body.SetTag(o);
         CollectionUtils.Put(_Bodys, o, body);
         return body;
     }
     else
     {
         throw new RuntimeException("You do not set the physics engine !");
     }
 }
Exemplo n.º 4
0
 public PBody BindCirclePhysics(bool fix, SpriteBatchObject o,
         float density)
 {
     if (usePhysics)
     {
         RectBox rect = o.GetRectBox();
         float r = (rect.width + rect.height) / 4;
         PBody body = _manager.AddCircle(fix, o.X(), o.Y(), r,
                 MathUtils.ToRadians(o.GetRotation()), density);
         body.SetTag(o);
         CollectionUtils.Put(_Bodys,o, body);
         return body;
     }
     else
     {
         throw new RuntimeException("You do not set the physics engine !");
     }
 }