API Docs for: 0.1.0
Show:

File: cangaja/box2d/b2d-circle.js

                        /**
                         * @description
                         *
                         * B2DCircle is a simple b2CircleShape wrapper element with basic physics properties.
                         *
                         ```
                        
                             var e = new CG.B2DCircle({
                                   name: 'player',
                                   image: this.asset.getImageByName('glowball'),
                                   radius: 20,
                                   x: 100,
                                   y: 100,
                                   world: b2world,
                                   scale: 40,
                                   bodyType: box2d.b2BodyType.b2_staticBody
                             })
                        
                         ```
                         *
                         * @class CG.B2DCirlce
                         * @extends CG.B2DEntity
                         */
                        
                        CG.B2DEntity.extend('B2DCircle', {
                            /**
                             * Options:
                             * name {string}
                             * image {mixed}
                             * radius {number}
                             * x {number}
                             * y (number}
                             * world {object}
                             * scale {number}
                             * bodyType {box2d.b2BodyType}
                             *
                             * @method init
                             * @constructor
                             * @param options     {Object}
                             * @return {*}
                             */
                            init:function (options) {
                        
                                CG._extend(this, {
                                    /**
                                     * @property radius
                                     * @type {Number}
                                     */
                                    radius: 0
                                })
                        
                                this._super(options)
                                this.instanceOf = 'B2DCircle'
                                this.setImage(this.image)
                        
                                /**
                                 * @property bodyDef.type
                                 * @type {box2d.b2BodyType.b2_staticBody/box2d.b2BodyType.b2_dynamicBody/box2d.b2BodyType.b2_kinematicBody/box2d.b2BodyType.b2_bulletBody}
                                 */
                                this.bodyDef.type = this.bodyType
                        
                                /**
                                 * @property bodyDef.position.x
                                 * @type {Number}
                                 */
                                this.bodyDef.position.x = this.x / this.scale
                                /**
                                 * @property bodyDef.position.y
                                 * @type {Number}
                                 */
                                this.bodyDef.position.y = this.y / this.scale
                                /**
                                 * @property bodyDef.userData
                                 * @type {*}
                                 */
                                this.bodyDef.userData = this.id
                                /**
                                 * @property fixDef.shape
                                 * @type {b2CircleShape}
                                 */
                                this.fixDef.shape = new b2CircleShape(this.radius / this.scale)
                        
                                /**
                                 * @property body
                                 * @type {b2Body}
                                 */
                                this.body = this.world.CreateBody(this.bodyDef)
                                this.body.CreateFixture(this.fixDef)
                        
                                return this
                        
                            }
                        })