Phaser Physics Snippets

start the physics engine
Description:starts the Arcade Physics engine
Example:game.physics.startSystem(Phaser.Physics.ARCADE);

Enable an object for physics
Description:Tell Phaser to use physics on this object
Example: game.physics.enable(this.char, Phaser.Physics.ARCADE);

Set Velocity
Description:Sets the velocity of an object
Example:this.char.body.velocity.setTo(xSpeed,ySpeed);

Set Bounce
Description:sets the bounce for the when the object collides. 1 is 100% bounce. .5 is 50%
Example:this.body.bounce.set(horizontal,vertical);

Set Global Gravity
Description:Sets the default gravity for all objects
Example:game.physics.arcade.gravity.y = gravityValue;

Set object gravity
Description:Sets the gravity on an individual sprite
Example:this.char.body.gravity.y = gravityValue;

set group physics
Description:Sets up a group for physics
Example://enable body for all child sprites myGroup.enableBody = true; //set the type of physics for all child sprites myGroup.physicsBodyType = Phaser.Physics.ARCADE;

set group physics
Description:allows group children to collide with each out. Place in update function
Example:game.physics.arcade.collide(this.myGroup);