LittleJS 1.30.1

Box2D

Box2dTileLayer

Box2d Tile Layer

  • adds Box2d support to tile layers
  • creates static box2d fixtures for solid tiles, call buildCollision to rebuild them after the tiles change
  • every cell with collision is a box solid from all sides, a one way tile (setOneWay) included

Extends Box2dStaticObject

Constructor

new Box2dTileLayer(tileLayer)box2d.js:1278

Create a Box2d tile layer object

tileLayer TileCollisionLayer

Tile layer for this object

Members

Methods

Inherited from Box2dObject

Inherited from EngineObject

Members

The tile layer

Methods

buildCollision(friction, restitution)box2d.js:1303

Create box2d collision fixtures for solid tiles

friction number optional, default 0.2
restitution number optional, default 0