Shaku

Shaku JS

Back To Table of Content

Shape

CollisionShape

Collision shape base class.

Kind: global class

new CollisionShape()

Create the collision shape.

collisionShape.shapeId ⇒ String

Get the collision shape’s unique identifier.

Kind: instance property of CollisionShape
Returns: String - Shape’s unique identifier

collisionShape.collisionFlags

Get collision flags (matched against collision mask when checking collision).

Kind: instance property of CollisionShape

collisionShape.collisionFlags

Set collision flags (matched against collision mask when checking collision).

Kind: instance property of CollisionShape

collisionShape.setDebugColor(color)

Set the debug color to use to draw this shape.

Kind: instance method of CollisionShape

Param Type Description
color Color Color to set or null to use default.

collisionShape.debugDraw(opacity, shapesBatch)

Debug draw this shape.

Kind: instance method of CollisionShape

Param Type Description
opacity Number Shape opacity factor.
shapesBatch ShapesBatch Optional shapes batch to use to debug draw the shape. By default will use the collision world.

collisionShape.getCenter() ⇒ Vector2

Get shape center position.

Kind: instance method of CollisionShape
Returns: Vector2 - Center position.

collisionShape.remove()

Remove self from parent world object.

Kind: instance method of CollisionShape