2013-10-25 15:54:40 +00:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
2015-03-23 23:46:30 +00:00
< title > Phaser Source: src/physics/arcade/Body.js< / title >
2013-10-25 15:54:40 +00:00
<!-- [if lt IE 9]>
< script src = "//html5shiv.googlecode.com/svn/trunk/html5.js" > < / script >
<![endif]-->
2014-11-15 20:01:46 +00:00
< link type = "text/css" rel = "stylesheet" href = "styles/default.css" >
2013-10-25 15:54:40 +00:00
< link type = "text/css" rel = "stylesheet" href = "styles/sunlight.default.css" >
< link type = "text/css" rel = "stylesheet" href = "styles/site.cerulean.css" >
< / head >
< body >
2014-11-25 00:23:44 +00:00
2013-10-25 15:54:40 +00:00
< div class = "container-fluid" >
< div class = "navbar navbar-fixed-top navbar-inverse" >
2014-11-25 00:23:44 +00:00
< div style = "position: absolute; width: 143px; height: 31px; right: 10px; top: 10px; z-index: 1050" > < a href = "http://phaser.io" > < img src = "img/phaser.png" border = "0" / > < / a > < / div >
2013-10-25 15:54:40 +00:00
< div class = "navbar-inner" >
2014-11-25 00:23:44 +00:00
< a class = "brand" href = "index.html" > Phaser API< / a >
2013-10-25 15:54:40 +00:00
< ul class = "nav" >
2014-11-25 00:23:44 +00:00
2013-10-25 15:54:40 +00:00
< li class = "dropdown" >
< a href = "namespaces.list.html" class = "dropdown-toggle" data-toggle = "dropdown" > Namespaces< b
class="caret">< / b > < / a >
< ul class = "dropdown-menu " >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-0" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.html" > Phaser< / a >
< / li >
2015-10-15 11:06:38 +00:00
< li class = "class-depth-0" >
< a href = "Phaser.KeyCode.html" > KeyCode< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-0" >
< a href = "PIXI.html" > PIXI< / a >
< / li >
2013-10-25 15:54:40 +00:00
< / ul >
< / li >
< li class = "dropdown" >
< a href = "classes.list.html" class = "dropdown-toggle" data-toggle = "dropdown" > Classes< b
class="caret">< / b > < / a >
< ul class = "dropdown-menu " >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Animation.html" > Animation< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.AnimationManager.html" > AnimationManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.AnimationParser.html" > AnimationParser< / a >
< / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ArraySet.html" > ArraySet< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ArrayUtils.html" > ArrayUtils< / a >
< / li >
2014-10-09 15:12:53 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.AudioSprite.html" > AudioSprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.BitmapData.html" > BitmapData< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.BitmapText.html" > BitmapText< / a >
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Bullet.html" > Bullet< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Button.html" > Button< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Cache.html" > Cache< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Camera.html" > Camera< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Canvas.html" > Canvas< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Circle.html" > Circle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Color.html" > Color< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-2" >
< a href = "Phaser.Component.Angle.html" > Angle< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Animation.html" > Animation< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.AutoCull.html" > AutoCull< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Bounds.html" > Bounds< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.BringToTop.html" > BringToTop< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Core.html" > Core< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Crop.html" > Crop< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Delta.html" > Delta< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Destroy.html" > Destroy< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.FixedToCamera.html" > FixedToCamera< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Health.html" > Health< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.InCamera.html" > InCamera< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.InputEnabled.html" > InputEnabled< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.InWorld.html" > InWorld< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.LifeSpan.html" > LifeSpan< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.LoadTexture.html" > LoadTexture< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Overlap.html" > Overlap< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.PhysicsBody.html" > PhysicsBody< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Reset.html" > Reset< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.ScaleMinMax.html" > ScaleMinMax< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Smoothed.html" > Smoothed< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Create.html" > Create< / a >
< / li >
< li class = "class-depth-1" >
< a href = "Phaser.Creature.html" > Creature< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Device.html" > Device< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.DeviceButton.html" > DeviceButton< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.DOM.html" > DOM< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Easing.html" > Easing< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Back.html" > Back< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Bounce.html" > Bounce< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Circular.html" > Circular< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Cubic.html" > Cubic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Elastic.html" > Elastic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Exponential.html" > Exponential< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Linear.html" > Linear< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Quadratic.html" > Quadratic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Quartic.html" > Quartic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Quintic.html" > Quintic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Sinusoidal.html" > Sinusoidal< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-21 15:37:26 +00:00
< a href = "Phaser.Ellipse.html" > Ellipse< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Events.html" > Events< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Filter.html" > Filter< / a >
< / li >
2014-09-09 14:36:56 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.FlexGrid.html" > FlexGrid< / a >
< / li >
< li class = "class-depth-1" >
< a href = "Phaser.FlexLayer.html" > FlexLayer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Frame.html" > Frame< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.FrameData.html" > FrameData< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Game.html" > Game< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-21 15:37:26 +00:00
< a href = "Phaser.GameObjectCreator.html" > GameObjectCreator< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.GameObjectFactory.html" > GameObjectFactory< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.Gamepad.html" > Gamepad< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Graphics.html" > Graphics< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Group.html" > Group< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-08 07:24:22 +00:00
< a href = "Phaser.Image.html" > Image< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ImageCollection.html" > ImageCollection< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Input.html" > Input< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.InputHandler.html" > InputHandler< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Key.html" > Key< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Keyboard.html" > Keyboard< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.Line.html" > Line< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.LinkedList.html" > LinkedList< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Loader.html" > Loader< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.LoaderParser.html" > LoaderParser< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Math.html" > Math< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Matrix.html" > Matrix< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Mouse.html" > Mouse< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.MSPointer.html" > MSPointer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Net.html" > Net< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Particle.html" > Particle< / a >
< / li >
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Particles.html" > Particles< / a >
< / li >
2014-10-09 15:12:53 +00:00
< li class = "class-depth-2" >
< a href = "Phaser.Particles.Arcade.html" > Arcade< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Particles.Arcade.Emitter.html" > Emitter< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Physics.html" > Physics< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Physics.Arcade.html" > Arcade< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Arcade.Body.html" > Body< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-3" >
2015-08-24 14:43:45 +00:00
< a href = "Phaser.Physics.Arcade.TilemapCollision.html" > TilemapCollision< / a >
2015-03-23 23:46:30 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.html" > Ninja< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.AABB.html" > AABB< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Body.html" > Body< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Circle.html" > Circle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Tile.html" > Tile< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.html" > P2< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Body.html" > Body< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.BodyDebug.html" > BodyDebug< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.CollisionGroup.html" > CollisionGroup< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.ContactMaterial.html" > ContactMaterial< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.DistanceConstraint.html" > DistanceConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-11 12:09:28 +00:00
< li class = "class-depth-3" >
< a href = "Phaser.Physics.P2.FixtureList.html" > FixtureList< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.GearConstraint.html" > GearConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.InversePointProxy.html" > InversePointProxy< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.LockConstraint.html" > LockConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Material.html" > Material< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.PointProxy.html" > PointProxy< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.PrismaticConstraint.html" > PrismaticConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.RevoluteConstraint.html" > RevoluteConstraint< / a >
< / li >
2014-09-09 14:36:56 +00:00
< li class = "class-depth-3" >
< a href = "Phaser.Physics.P2.RotationalSpring.html" > RotationalSpring< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Spring.html" > Spring< / a >
2013-10-25 16:30:37 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Plugin.html" > Plugin< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.PluginManager.html" > PluginManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Point.html" > Point< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Pointer.html" > Pointer< / a >
< / li >
2015-10-15 11:06:38 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.PointerMode.html" > PointerMode< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-07 06:10:15 +00:00
< a href = "Phaser.Polygon.html" > Polygon< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.QuadTree.html" > QuadTree< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.RandomDataGenerator.html" > RandomDataGenerator< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Rectangle.html" > Rectangle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.RenderTexture.html" > RenderTexture< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.RequestAnimationFrame.html" > RequestAnimationFrame< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.RetroFont.html" > RetroFont< / a >
< / li >
2014-09-09 14:36:56 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Rope.html" > Rope< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.RoundedRectangle.html" > RoundedRectangle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.ScaleManager.html" > ScaleManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Signal.html" > Signal< / a >
< / li >
2014-04-11 12:09:28 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.SignalBinding.html" > SignalBinding< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.SinglePad.html" > SinglePad< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Sound.html" > Sound< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.SoundManager.html" > SoundManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Sprite.html" > Sprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-21 15:37:26 +00:00
< a href = "Phaser.SpriteBatch.html" > SpriteBatch< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Stage.html" > Stage< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.State.html" > State< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.StateManager.html" > StateManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Text.html" > Text< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tile.html" > Tile< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tilemap.html" > Tilemap< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.TilemapLayer.html" > TilemapLayer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.TilemapParser.html" > TilemapParser< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tileset.html" > Tileset< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.TileSprite.html" > TileSprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Time.html" > Time< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Timer.html" > Timer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.TimerEvent.html" > TimerEvent< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Touch.html" > Touch< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Tween.html" > Tween< / a >
< / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.TweenData.html" > TweenData< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.TweenManager.html" > TweenManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Utils.html" > Utils< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Utils.Debug.html" > Debug< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2015-07-22 14:31:30 +00:00
< a href = "Phaser.Video.html" > Video< / a >
2013-10-25 15:54:40 +00:00
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Weapon.html" > Weapon< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
2015-07-22 14:31:30 +00:00
< a href = "Phaser.World.html" > World< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-07-22 14:31:30 +00:00
< a href = "PIXI.AbstractFilter.html" > AbstractFilter< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-07-22 14:31:30 +00:00
< a href = "PIXI.BaseTexture.html" > BaseTexture< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasBuffer.html" > CanvasBuffer< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasGraphics.html" > CanvasGraphics< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasMaskManager.html" > CanvasMaskManager< / a >
< / li >
2015-08-24 14:43:45 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.CanvasPool.html" > CanvasPool< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.CanvasRenderer.html" > CanvasRenderer< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasTinter.html" > CanvasTinter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.ComplexPrimitiveShader.html" > ComplexPrimitiveShader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.DisplayObjectContainer.html" > DisplayObjectContainer< / a >
< / li >
2016-02-08 17:01:36 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.EarCut.html" > EarCut< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.Event.html" > Event< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.EventTarget.html" > EventTarget< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.FilterTexture.html" > FilterTexture< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Graphics.html" > Graphics< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.GraphicsData.html" > GraphicsData< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.PIXI.html" > PIXI< / a >
< / li >
2016-07-01 15:57:13 +00:00
< li class = "class-depth-2" >
< a href = "PIXI.PIXI.DisplayObject.html" > DisplayObject< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.PixiFastShader.html" > PixiFastShader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.PixiShader.html" > PixiShader< / a >
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.PolyK.html" > PolyK< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.PrimitiveShader.html" > PrimitiveShader< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.RenderTexture.html" > RenderTexture< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.Rope.html" > Rope< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.Sprite.html" > Sprite< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.SpriteBatch.html" > SpriteBatch< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.Strip.html" > Strip< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.StripShader.html" > StripShader< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.Texture.html" > Texture< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.TilingSprite.html" > TilingSprite< / a >
2014-11-15 20:01:46 +00:00
< / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.WebGLBlendModeManager.html" > WebGLBlendModeManager< / a >
2014-11-25 00:23:44 +00:00
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.WebGLFastSpriteBatch.html" > WebGLFastSpriteBatch< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.WebGLFilterManager.html" > WebGLFilterManager< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.WebGLRenderer.html" > WebGLRenderer< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< / ul >
< / li >
< li class = "dropdown" >
< a href = "global.html" class = "dropdown-toggle" data-toggle = "dropdown" > Global< b
class="caret">< / b > < / a >
< ul class = "dropdown-menu " >
2016-06-03 17:48:34 +00:00
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_DOWN" > ANGLE_DOWN< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_LEFT" > ANGLE_LEFT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_NORTH_EAST" > ANGLE_NORTH_EAST< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_NORTH_WEST" > ANGLE_NORTH_WEST< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_RIGHT" > ANGLE_RIGHT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_SOUTH_EAST" > ANGLE_SOUTH_EAST< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_SOUTH_WEST" > ANGLE_SOUTH_WEST< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_UP" > ANGLE_UP< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#AUTO" > AUTO< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#BITMAPDATA" > BITMAPDATA< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#BITMAPTEXT" > BITMAPTEXT< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#blendModes" > blendModes< / a >
2014-11-15 20:01:46 +00:00
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-0" >
< a href = "global.html#BOTTOM_CENTER" > BOTTOM_CENTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#BOTTOM_LEFT" > BOTTOM_LEFT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#BOTTOM_RIGHT" > BOTTOM_RIGHT< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#BUTTON" > BUTTON< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#CANVAS" > CANVAS< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#CANVAS_FILTER" > CANVAS_FILTER< / a >
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-0" >
< a href = "global.html#CENTER" > CENTER< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#CIRCLE" > CIRCLE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#CREATURE" > CREATURE< / a >
< / li >
2016-06-09 16:13:31 +00:00
< li class = "class-depth-0" >
< a href = "global.html#displayList" > displayList< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#DOWN" > DOWN< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ELLIPSE" > ELLIPSE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#EMITTER" > EMITTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#GAMES" > GAMES< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#GRAPHICS" > GRAPHICS< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#GROUP" > GROUP< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#HEADLESS" > HEADLESS< / a >
< / li >
2016-06-09 16:13:31 +00:00
< li class = "class-depth-0" >
< a href = "global.html#HORIZONTAL" > HORIZONTAL< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#IMAGE" > IMAGE< / a >
< / li >
2016-06-03 17:48:34 +00:00
< li class = "class-depth-0" >
< a href = "global.html#intersectsRectangle" > intersectsRectangle< / a >
< / li >
2016-06-09 16:13:31 +00:00
< li class = "class-depth-0" >
< a href = "global.html#LANDSCAPE" > LANDSCAPE< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#LEFT" > LEFT< / a >
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-0" >
< a href = "global.html#LEFT_BOTTOM" > LEFT_BOTTOM< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#LEFT_CENTER" > LEFT_CENTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#LEFT_TOP" > LEFT_TOP< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#LINE" > LINE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#MATRIX" > MATRIX< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#NONE" > NONE< / a >
< / li >
2016-02-08 17:01:36 +00:00
< li class = "class-depth-0" >
< a href = "global.html#PENDING_ATLAS" > PENDING_ATLAS< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#POINT" > POINT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#POINTER" > POINTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#POLYGON" > POLYGON< / a >
< / li >
2016-06-09 16:13:31 +00:00
< li class = "class-depth-0" >
< a href = "global.html#PORTRAIT" > PORTRAIT< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#RECTANGLE" > RECTANGLE< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#RENDERTEXTURE" > RENDERTEXTURE< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#RETROFONT" > RETROFONT< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#RIGHT" > RIGHT< / a >
2014-11-15 20:01:46 +00:00
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-0" >
< a href = "global.html#RIGHT_BOTTOM" > RIGHT_BOTTOM< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#RIGHT_CENTER" > RIGHT_CENTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#RIGHT_TOP" > RIGHT_TOP< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#ROPE" > ROPE< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#ROUNDEDRECTANGLE" > ROUNDEDRECTANGLE< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#scaleModes" > scaleModes< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#SPRITE" > SPRITE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#SPRITEBATCH" > SPRITEBATCH< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TEXT" > TEXT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TILEMAP" > TILEMAP< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TILEMAPLAYER" > TILEMAPLAYER< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#TILESPRITE" > TILESPRITE< / a >
2014-11-15 20:01:46 +00:00
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-0" >
< a href = "global.html#TOP_CENTER" > TOP_CENTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TOP_LEFT" > TOP_LEFT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TOP_RIGHT" > TOP_RIGHT< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#UP" > UP< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#VERSION" > VERSION< / a >
< / li >
2016-06-09 16:13:31 +00:00
< li class = "class-depth-0" >
< a href = "global.html#VERTICAL" > VERTICAL< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#VIDEO" > VIDEO< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#WEBGL" > WEBGL< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#WEBGL_FILTER" > WEBGL_FILTER< / a >
2014-11-15 20:01:46 +00:00
< / li >
2013-10-25 15:54:40 +00:00
< / ul >
< / li >
2014-11-25 00:23:44 +00:00
2014-11-15 20:01:46 +00:00
< li class = "dropdown" >
2014-11-25 00:23:44 +00:00
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Core< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
2014-12-03 10:39:11 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Game.html" > Game< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Group.html" > Group< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.World.html" > World< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Loader.html" > Loader< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Cache.html" > Cache< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Time.html" > Time< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Camera.html" > Camera< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.StateManager.html" > State Manager< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.TweenManager.html" > Tween Manager< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.SoundManager.html" > Sound Manager< / a > < / li >
2015-01-06 06:57:25 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Input.html" > Input Manager< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.ScaleManager.html" > Scale Manager< / a > < / li >
< / ul >
< / li >
2014-11-15 20:01:46 +00:00
2014-11-25 00:23:44 +00:00
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Game Objects< b class = "caret" > < / b > < / a >
2014-11-15 20:01:46 +00:00
< ul class = "dropdown-menu " >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.GameObjectFactory.html" > Factory (game.add)< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.GameObjectCreator.html" > Creator (game.make)< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Sprite.html" > Sprite< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Image.html" > Image< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Sound.html" > Sound< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Video.html" > Video< / a > < / li >
2015-01-06 06:57:25 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Particles.Arcade.Emitter.html" > Particle Emitter< / a > < / li >
2014-12-03 10:39:11 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Particle.html" > Particle< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Text.html" > Text< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Tween.html" > Tween< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.BitmapText.html" > BitmapText< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Tilemap.html" > Tilemap< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.BitmapData.html" > BitmapData< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.RetroFont.html" > RetroFont< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Button.html" > Button< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Animation.html" > Animation< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Graphics.html" > Graphics< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.RenderTexture.html" > RenderTexture< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.TileSprite.html" > TileSprite< / a > < / li >
< / ul >
< / li >
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Geometry< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
< li class = "class-depth-1" > < a href = "Phaser.Circle.html" > Circle< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Ellipse.html" > Ellipse< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Line.html" > Line< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Matrix.html" > Matrix< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Point.html" > Point< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Polygon.html" > Polygon< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Rectangle.html" > Rectangle< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.RoundedRectangle.html" > Rounded Rectangle< / a > < / li >
2014-11-25 00:23:44 +00:00
< / ul >
< / li >
2014-11-15 20:01:46 +00:00
2014-11-25 00:23:44 +00:00
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Physics< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
< li class = "class-depth-1" > < a href = "Phaser.Physics.Arcade.html" > Arcade Physics< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.Arcade.Body.html" > Body< / a > < / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-2" > < a href = "Phaser.Weapon.html" > Weapon< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Physics.P2.html" > P2 Physics< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.Body.html" > Body< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.Spring.html" > Spring< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.CollisionGroup.html" > CollisionGroup< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.ContactMaterial.html" > ContactMaterial< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Physics.Ninja.html" > Ninja Physics< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.Body.html" > Body< / a > < / li >
2014-11-15 20:01:46 +00:00
< / ul >
< / li >
2014-11-25 00:23:44 +00:00
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Input< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
< li class = "class-depth-1" > < a href = "Phaser.InputHandler.html" > Input Handler< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Pointer.html" > Pointer< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.DeviceButton.html" > Device Button< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Mouse.html" > Mouse< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Keyboard.html" > Keyboard< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Key.html" > Key< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Gamepad.html" > Gamepad< / a > < / li >
< / ul >
< / li >
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Community< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
2015-03-26 02:55:18 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io" > Phaser Web Site< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "https://github.com/photonstorm/phaser" > Phaser Github< / a > < / li >
2015-03-26 02:55:18 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io/examples" > Phaser Examples< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "https://github.com/photonstorm/phaser-plugins" > Phaser Plugins< / a > < / li >
< li class = "class-depth-1" > < a href = "http://www.html5gamedevs.com/forum/14-phaser/" > Forum< / a > < / li >
< li class = "class-depth-1" > < a href = "http://stackoverflow.com/questions/tagged/phaser-framework" > Stack Overflow< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io/learn" > Tutorials< / a > < / li >
2016-05-19 11:36:51 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io/community/newsletter" > Newsletter< / a > < / li >
2015-03-26 02:55:18 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io/community/twitter" > Twitter< / a > < / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io/community/slack" > Slack< / a > < / li >
< li class = "class-depth-1" > < a href = "http://phaser.io/community/donate" > Donate< / a > < / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-1" > < a href = "https://www.codeandweb.com/texturepacker/phaser" > Texture Packer< / a > < / li >
2014-11-25 00:23:44 +00:00
< / ul >
< / li >
2013-10-25 15:54:40 +00:00
< / ul >
< / div >
< / div >
< div class = "row-fluid" >
< div class = "span12" >
< div id = "main" >
2015-03-23 23:46:30 +00:00
< h1 class = "page-title" > Source: src/physics/arcade/Body.js< / h1 >
2013-10-25 15:54:40 +00:00
< section >
< article >
2013-10-25 16:30:37 +00:00
< pre class = "sunlight-highlight-javascript linenums" > /**
* @author Richard Davey < rich@photonstorm.com>
2016-04-22 14:15:28 +00:00
* @copyright 2016 Photon Storm Ltd.
2013-10-25 16:30:37 +00:00
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
2014-03-14 06:36:05 +00:00
* The Physics Body is linked to a single Sprite. All physics operations should be performed against the body rather than
* the Sprite itself. For example you can set the velocity, acceleration, bounce values etc all on the Body.
2013-10-25 16:30:37 +00:00
*
2014-03-14 06:36:05 +00:00
* @class Phaser.Physics.Arcade.Body
2013-10-25 16:30:37 +00:00
* @constructor
2014-03-14 06:36:05 +00:00
* @param {Phaser.Sprite} sprite - The Sprite object this physics body belongs to.
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
Phaser.Physics.Arcade.Body = function (sprite) {
2014-02-21 15:37:26 +00:00
2014-03-14 06:36:05 +00:00
/**
* @property {Phaser.Sprite} sprite - Reference to the parent Sprite.
*/
this.sprite = sprite;
2013-10-25 15:54:40 +00:00
2013-10-25 16:30:37 +00:00
/**
2014-02-21 15:37:26 +00:00
* @property {Phaser.Game} game - Local reference to game.
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
this.game = sprite.game;
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* @property {number} type - The type of physics system this body belongs to.
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
this.type = Phaser.Physics.ARCADE;
2013-10-25 15:54:40 +00:00
2014-07-10 19:31:11 +00:00
/**
* @property {boolean} enable - A disabled body won't be checked for any form of collision or overlap or have its pre/post updates run.
* @default
*/
this.enable = true;
2016-07-08 14:46:26 +00:00
/**
* If `true` this Body is using circular collision detection. If `false` it is using rectangular.
* Use `Body.setCircle` to control the collision shape this Body uses.
* @property {boolean} isCircle
* @default
* @readOnly
*/
this.isCircle = false;
/**
* The radius of the circular collision shape this Body is using if Body.setCircle has been enabled.
* If you wish to change the radius then call `setCircle` again with the new value.
* If you wish to stop the Body using a circle then call `setCircle` with a radius of zero (or undefined).
* @property {number} radius
* @default
* @readOnly
*/
this.radius = 0;
2013-10-25 16:30:37 +00:00
/**
* @property {Phaser.Point} offset - The offset of the Physics Body from the Sprite x/y position.
*/
2013-11-28 15:57:09 +00:00
this.offset = new Phaser.Point();
2013-10-25 15:54:40 +00:00
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* @property {Phaser.Point} position - The position of the physics body.
* @readonly
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
this.position = new Phaser.Point(sprite.x, sprite.y);
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* @property {Phaser.Point} prev - The previous position of the physics body.
* @readonly
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
this.prev = new Phaser.Point(this.position.x, this.position.y);
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* @property {boolean} allowRotation - Allow this Body to be rotated? (via angularVelocity, etc)
* @default
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
this.allowRotation = true;
2013-10-25 16:30:37 +00:00
/**
2015-03-23 23:46:30 +00:00
* An Arcade Physics Body can have angularVelocity and angularAcceleration. Please understand that the collision Body
* itself never rotates, it is always axis-aligned. However these values are passed up to the parent Sprite and updates its rotation.
* @property {number} rotation
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
this.rotation = sprite.rotation;
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* @property {number} preRotation - The previous rotation of the physics body.
* @readonly
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
this.preRotation = sprite.rotation;
2013-10-25 16:30:37 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {number} width - The calculated width of the physics body.
2014-03-14 06:36:05 +00:00
* @readonly
2013-10-25 16:30:37 +00:00
*/
2015-03-23 23:46:30 +00:00
this.width = sprite.width;
2013-10-25 16:30:37 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {number} height - The calculated height of the physics body.
2014-03-14 06:36:05 +00:00
* @readonly
2013-10-25 16:30:37 +00:00
*/
2015-03-23 23:46:30 +00:00
this.height = sprite.height;
2013-10-25 15:54:40 +00:00
2013-10-25 16:30:37 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {number} sourceWidth - The un-scaled original size.
* @readonly
2013-10-25 16:30:37 +00:00
*/
2015-03-23 23:46:30 +00:00
this.sourceWidth = sprite.width;
2013-10-25 16:30:37 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {number} sourceHeight - The un-scaled original size.
* @readonly
2014-03-14 06:36:05 +00:00
*/
2015-03-23 23:46:30 +00:00
this.sourceHeight = sprite.height;
if (sprite.texture)
{
this.sourceWidth = sprite.texture.frame.width;
this.sourceHeight = sprite.texture.frame.height;
}
2014-03-14 06:36:05 +00:00
/**
* @property {number} halfWidth - The calculated width / 2 of the physics body.
2015-03-23 23:46:30 +00:00
* @readonly
2014-03-14 06:36:05 +00:00
*/
this.halfWidth = Math.abs(sprite.width / 2);
/**
* @property {number} halfHeight - The calculated height / 2 of the physics body.
2015-03-23 23:46:30 +00:00
* @readonly
2014-03-14 06:36:05 +00:00
*/
this.halfHeight = Math.abs(sprite.height / 2);
/**
* @property {Phaser.Point} center - The center coordinate of the Physics Body.
2015-03-23 23:46:30 +00:00
* @readonly
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
this.center = new Phaser.Point(sprite.x + this.halfWidth, sprite.y + this.halfHeight);
2013-10-25 15:54:40 +00:00
2014-03-14 06:36:05 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {Phaser.Point} velocity - The velocity, or rate of change in speed of the Body. Measured in pixels per second.
2014-03-14 06:36:05 +00:00
*/
this.velocity = new Phaser.Point();
2013-10-25 16:30:37 +00:00
2014-03-14 06:36:05 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {Phaser.Point} newVelocity - The new velocity. Calculated during the Body.preUpdate and applied to its position.
2014-03-14 06:36:05 +00:00
* @readonly
*/
2016-07-08 14:46:26 +00:00
this.newVelocity = new Phaser.Point();
2013-10-25 15:54:40 +00:00
2014-03-24 12:41:45 +00:00
/**
* @property {Phaser.Point} deltaMax - The Sprite position is updated based on the delta x/y values. You can set a cap on those (both +-) using deltaMax.
*/
2016-07-08 14:46:26 +00:00
this.deltaMax = new Phaser.Point();
2014-03-24 12:41:45 +00:00
2014-03-14 06:36:05 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {Phaser.Point} acceleration - The acceleration is the rate of change of the velocity. Measured in pixels per second squared.
2014-03-14 06:36:05 +00:00
*/
this.acceleration = new Phaser.Point();
2013-11-01 18:16:52 +00:00
2014-03-14 06:36:05 +00:00
/**
* @property {Phaser.Point} drag - The drag applied to the motion of the Body.
*/
this.drag = new Phaser.Point();
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* @property {boolean} allowGravity - Allow this Body to be influenced by gravity? Either world or local.
* @default
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
this.allowGravity = true;
2013-10-25 15:54:40 +00:00
2014-03-14 06:36:05 +00:00
/**
* @property {Phaser.Point} gravity - A local gravity applied to this Body. If non-zero this over rides any world gravity, unless Body.allowGravity is set to false.
*/
2016-07-08 14:46:26 +00:00
this.gravity = new Phaser.Point();
2013-10-25 16:30:37 +00:00
2014-03-14 06:36:05 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {Phaser.Point} bounce - The elasticity of the Body when colliding. bounce.x/y = 1 means full rebound, bounce.x/y = 0.5 means 50% rebound velocity.
2014-03-14 06:36:05 +00:00
*/
this.bounce = new Phaser.Point();
2013-10-25 16:30:37 +00:00
2016-05-19 11:36:51 +00:00
/**
* The elasticity of the Body when colliding with the World bounds.
* By default this property is `null`, in which case `Body.bounce` is used instead. Set this property
* to a Phaser.Point object in order to enable a World bounds specific bounce value.
* @property {Phaser.Point} worldBounce
*/
this.worldBounce = null;
2016-07-08 14:46:26 +00:00
/**
* A Signal that is dispatched when this Body collides with the world bounds.
* Due to the potentially high volume of signals this could create it is disabled by default.
* To use this feature set this property to a Phaser.Signal: `sprite.body.onWorldBounds = new Phaser.Signal()`
* and it will be called when a collision happens, passing five arguments:
* `onWorldBounds(sprite, up, down, left, right)`
* where the Sprite is a reference to the Sprite that owns this Body, and the other arguments are booleans
* indicating on which side of the world the Body collided.
* @property {Phaser.Signal} onWorldBounds
*/
this.onWorldBounds = null;
/**
* A Signal that is dispatched when this Body collides with another Body.
*
* You still need to call `game.physics.arcade.collide` in your `update` method in order
* for this signal to be dispatched.
*
* Usually you'd pass a callback to the `collide` method, but this signal provides for
* a different level of notification.
*
* Due to the potentially high volume of signals this could create it is disabled by default.
*
* To use this feature set this property to a Phaser.Signal: `sprite.body.onCollide = new Phaser.Signal()`
* and it will be called when a collision happens, passing two arguments: the sprites which collided.
* The first sprite in the argument is always the owner of this Body.
*
* If two Bodies with this Signal set collide, both will dispatch the Signal.
* @property {Phaser.Signal} onCollide
*/
this.onCollide = null;
/**
* A Signal that is dispatched when this Body overlaps with another Body.
*
* You still need to call `game.physics.arcade.overlap` in your `update` method in order
* for this signal to be dispatched.
*
* Usually you'd pass a callback to the `overlap` method, but this signal provides for
* a different level of notification.
*
* Due to the potentially high volume of signals this could create it is disabled by default.
*
* To use this feature set this property to a Phaser.Signal: `sprite.body.onOverlap = new Phaser.Signal()`
* and it will be called when a collision happens, passing two arguments: the sprites which collided.
* The first sprite in the argument is always the owner of this Body.
*
* If two Bodies with this Signal set collide, both will dispatch the Signal.
* @property {Phaser.Signal} onOverlap
*/
this.onOverlap = null;
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* @property {Phaser.Point} maxVelocity - The maximum velocity in pixels per second sq. that the Body can reach.
* @default
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
this.maxVelocity = new Phaser.Point(10000, 10000);
2013-10-25 16:30:37 +00:00
2014-03-14 06:36:05 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {Phaser.Point} friction - The amount of movement that will occur if another object 'rides' this one.
*/
this.friction = new Phaser.Point(1, 0);
/**
* @property {number} angularVelocity - The angular velocity controls the rotation speed of the Body. It is measured in radians per second.
2014-03-14 06:36:05 +00:00
* @default
*/
this.angularVelocity = 0;
2013-10-25 16:30:37 +00:00
2014-03-14 06:36:05 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {number} angularAcceleration - The angular acceleration is the rate of change of the angular velocity. Measured in radians per second squared.
2014-03-14 06:36:05 +00:00
* @default
*/
this.angularAcceleration = 0;
2013-10-25 16:30:37 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {number} angularDrag - The drag applied during the rotation of the Body.
2014-03-14 06:36:05 +00:00
* @default
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
this.angularDrag = 0;
2013-10-25 15:54:40 +00:00
2014-03-14 06:36:05 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {number} maxAngular - The maximum angular velocity in radians per second that the Body can reach.
2014-03-14 06:36:05 +00:00
* @default
*/
this.maxAngular = 1000;
2013-10-25 16:30:37 +00:00
2014-03-14 06:36:05 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {number} mass - The mass of the Body. When two bodies collide their mass is used in the calculation to determine the exchange of velocity.
2014-03-14 06:36:05 +00:00
* @default
*/
this.mass = 1;
/**
2015-03-23 23:46:30 +00:00
* @property {number} angle - The angle of the Body in radians, as calculated by its angularVelocity.
2014-03-14 06:36:05 +00:00
* @readonly
*/
this.angle = 0;
/**
* @property {number} speed - The speed of the Body as calculated by its velocity.
* @readonly
*/
this.speed = 0;
/**
* @property {number} facing - A const reference to the direction the Body is traveling or facing.
* @default
*/
this.facing = Phaser.NONE;
/**
* @property {boolean} immovable - An immovable Body will not receive any impacts from other bodies.
* @default
*/
this.immovable = false;
/**
* If you have a Body that is being moved around the world via a tween or a Group motion, but its local x/y position never
* actually changes, then you should set Body.moves = false. Otherwise it will most likely fly off the screen.
* If you want the physics system to move the body around, then set moves to true.
2015-03-23 23:46:30 +00:00
* @property {boolean} moves - Set to true to allow the Physics system to move this Body, otherwise false to move it manually.
2014-03-14 06:36:05 +00:00
* @default
*/
this.moves = true;
/**
* This flag allows you to disable the custom x separation that takes place by Physics.Arcade.separate.
* Used in combination with your own collision processHandler you can create whatever type of collision response you need.
* @property {boolean} customSeparateX - Use a custom separation system or the built-in one?
* @default
*/
this.customSeparateX = false;
/**
* This flag allows you to disable the custom y separation that takes place by Physics.Arcade.separate.
* Used in combination with your own collision processHandler you can create whatever type of collision response you need.
* @property {boolean} customSeparateY - Use a custom separation system or the built-in one?
* @default
*/
this.customSeparateY = false;
/**
* When this body collides with another, the amount of overlap is stored here.
* @property {number} overlapX - The amount of horizontal overlap during the collision.
*/
this.overlapX = 0;
/**
* When this body collides with another, the amount of overlap is stored here.
* @property {number} overlapY - The amount of vertical overlap during the collision.
*/
this.overlapY = 0;
2016-07-08 14:46:26 +00:00
/**
* If `Body.isCircle` is true, and this body collides with another circular body, the amount of overlap is stored here.
* @property {number} overlapR - The amount of overlap during the collision.
*/
this.overlapR = 0;
2014-03-14 06:36:05 +00:00
/**
* If a body is overlapping with another body, but neither of them are moving (maybe they spawned on-top of each other?) this is set to true.
* @property {boolean} embedded - Body embed value.
*/
this.embedded = false;
/**
* A Body can be set to collide against the World bounds automatically and rebound back into the World if this is set to true. Otherwise it will leave the World.
* @property {boolean} collideWorldBounds - Should the Body collide with the World bounds?
*/
this.collideWorldBounds = false;
/**
* Set the checkCollision properties to control which directions collision is processed for this Body.
* For example checkCollision.up = false means it won't collide when the collision happened while moving up.
* @property {object} checkCollision - An object containing allowed collision.
*/
this.checkCollision = { none: false, any: true, up: true, down: true, left: true, right: true };
/**
* This object is populated with boolean values when the Body collides with another.
* touching.up = true means the collision happened to the top of this Body for example.
* @property {object} touching - An object containing touching results.
*/
this.touching = { none: true, up: false, down: false, left: false, right: false };
/**
* This object is populated with previous touching values from the bodies previous collision.
* @property {object} wasTouching - An object containing previous touching results.
*/
this.wasTouching = { none: true, up: false, down: false, left: false, right: false };
/**
* This object is populated with boolean values when the Body collides with the World bounds or a Tile.
* For example if blocked.up is true then the Body cannot move up.
* @property {object} blocked - An object containing on which faces this Body is blocked from moving, if any.
*/
this.blocked = { up: false, down: false, left: false, right: false };
/**
* If this is an especially small or fast moving object then it can sometimes skip over tilemap collisions if it moves through a tile in a step.
* Set this padding value to add extra padding to its bounds. tilePadding.x applied to its width, y to its height.
2015-03-23 23:46:30 +00:00
* @property {Phaser.Point} tilePadding - Extra padding to be added to this sprite's dimensions when checking for tile collision.
2014-03-14 06:36:05 +00:00
*/
this.tilePadding = new Phaser.Point();
2014-03-28 01:42:49 +00:00
/**
2015-03-23 23:46:30 +00:00
* @property {boolean} dirty - If this Body in a preUpdate (true) or postUpdate (false) state?
2014-03-28 01:42:49 +00:00
*/
2015-03-23 23:46:30 +00:00
this.dirty = false;
2014-03-28 01:42:49 +00:00
2014-09-09 14:36:56 +00:00
/**
* @property {boolean} skipQuadTree - If true and you collide this Sprite against a Group, it will disable the collision check from using a QuadTree.
*/
this.skipQuadTree = false;
2015-07-22 14:31:30 +00:00
/**
* If true the Body will check itself against the Sprite.getBounds() dimensions and adjust its width and height accordingly.
* If false it will compare its dimensions against the Sprite scale instead, and adjust its width height if the scale has changed.
* Typically you would need to enable syncBounds if your sprite is the child of a responsive display object such as a FlexLayer,
* or in any situation where the Sprite scale doesn't change, but its parents scale is effecting the dimensions regardless.
* @property {boolean} syncBounds
* @default
*/
this.syncBounds = false;
2016-06-17 00:11:24 +00:00
/**
* @property {boolean} isMoving - Set by the `moveTo` and `moveFrom` methods.
*/
this.isMoving = false;
/**
* @property {boolean} stopVelocityOnCollide - Set by the `moveTo` and `moveFrom` methods.
*/
this.stopVelocityOnCollide = true;
/**
* @property {integer} moveTimer - Internal time used by the `moveTo` and `moveFrom` methods.
* @private
*/
this.moveTimer = 0;
/**
* @property {integer} moveDistance - Internal distance value, used by the `moveTo` and `moveFrom` methods.
* @private
*/
this.moveDistance = 0;
/**
* @property {integer} moveDuration - Internal duration value, used by the `moveTo` and `moveFrom` methods.
* @private
*/
this.moveDuration = 0;
/**
* @property {Phaser.Line} moveTarget - Set by the `moveTo` method, and updated each frame.
* @private
*/
this.moveTarget = null;
/**
* @property {Phaser.Point} moveEnd - Set by the `moveTo` method, and updated each frame.
* @private
*/
this.moveEnd = null;
/**
* @property {Phaser.Signal} onMoveComplete - Listen for the completion of `moveTo` or `moveFrom` events.
*/
this.onMoveComplete = new Phaser.Signal();
/**
* @property {function} movementCallback - Optional callback. If set, invoked during the running of `moveTo` or `moveFrom` events.
*/
this.movementCallback = null;
/**
* @property {object} movementCallbackContext - Context in which to call the movementCallback.
*/
this.movementCallbackContext = null;
2014-03-28 01:42:49 +00:00
/**
* @property {boolean} _reset - Internal cache var.
* @private
*/
this._reset = true;
2014-03-24 12:41:45 +00:00
/**
* @property {number} _sx - Internal cache var.
* @private
*/
this._sx = sprite.scale.x;
/**
* @property {number} _sy - Internal cache var.
* @private
*/
this._sy = sprite.scale.y;
/**
* @property {number} _dx - Internal cache var.
* @private
*/
this._dx = 0;
/**
* @property {number} _dy - Internal cache var.
* @private
*/
this._dy = 0;
2014-03-14 06:36:05 +00:00
};
Phaser.Physics.Arcade.Body.prototype = {
/**
* Internal method.
*
2014-04-10 22:13:43 +00:00
* @method Phaser.Physics.Arcade.Body#updateBounds
2014-03-14 06:36:05 +00:00
* @protected
*/
2014-03-24 12:41:45 +00:00
updateBounds: function () {
2013-10-25 16:30:37 +00:00
2015-07-22 14:31:30 +00:00
if (this.syncBounds)
{
var b = this.sprite.getBounds();
b.ceilAll();
2014-03-24 12:41:45 +00:00
2015-07-22 14:31:30 +00:00
if (b.width !== this.width || b.height !== this.height)
{
this.width = b.width;
this.height = b.height;
this._reset = true;
}
}
else
{
var asx = Math.abs(this.sprite.scale.x);
var asy = Math.abs(this.sprite.scale.y);
if (asx !== this._sx || asy !== this._sy)
{
this.width = this.sourceWidth * asx;
this.height = this.sourceHeight * asy;
this._sx = asx;
this._sy = asy;
this._reset = true;
}
}
if (this._reset)
2014-02-21 15:37:26 +00:00
{
2014-03-14 06:36:05 +00:00
this.halfWidth = Math.floor(this.width / 2);
this.halfHeight = Math.floor(this.height / 2);
2014-03-24 12:41:45 +00:00
this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight);
2014-02-21 15:37:26 +00:00
}
2013-10-25 16:30:37 +00:00
2014-02-21 15:37:26 +00:00
},
2013-10-25 15:54:40 +00:00
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* Internal method.
2014-02-21 15:37:26 +00:00
*
2014-04-10 22:13:43 +00:00
* @method Phaser.Physics.Arcade.Body#preUpdate
2014-03-14 06:36:05 +00:00
* @protected
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
preUpdate: function () {
2015-03-23 23:46:30 +00:00
if (!this.enable || this.game.physics.arcade.isPaused)
2014-07-10 19:31:11 +00:00
{
return;
}
2015-03-23 23:46:30 +00:00
this.dirty = true;
2014-03-28 01:42:49 +00:00
2014-03-14 06:36:05 +00:00
// Store and reset collision flags
this.wasTouching.none = this.touching.none;
this.wasTouching.up = this.touching.up;
this.wasTouching.down = this.touching.down;
this.wasTouching.left = this.touching.left;
this.wasTouching.right = this.touching.right;
this.touching.none = true;
this.touching.up = false;
this.touching.down = false;
this.touching.left = false;
this.touching.right = false;
this.blocked.up = false;
this.blocked.down = false;
this.blocked.left = false;
this.blocked.right = false;
2013-10-25 16:30:37 +00:00
2014-03-24 12:41:45 +00:00
this.embedded = false;
2014-03-28 01:42:49 +00:00
this.updateBounds();
2016-06-03 17:48:34 +00:00
this.position.x = (this.sprite.world.x - (this.sprite.anchor.x * this.sprite.width)) + this.sprite.scale.x * this.offset.x;
this.position.x -= this.sprite.scale.x < 0 ? this.width : 0;
this.position.y = (this.sprite.world.y - (this.sprite.anchor.y * this.sprite.height)) + this.sprite.scale.y * this.offset.y;
this.position.y -= this.sprite.scale.y < 0 ? this.height : 0;
2016-05-19 11:36:51 +00:00
2014-03-24 12:41:45 +00:00
this.rotation = this.sprite.angle;
this.preRotation = this.rotation;
2015-03-23 23:46:30 +00:00
if (this._reset || this.sprite.fresh)
2014-03-24 12:41:45 +00:00
{
this.prev.x = this.position.x;
this.prev.y = this.position.y;
}
2014-03-14 06:36:05 +00:00
if (this.moves)
2014-02-21 15:37:26 +00:00
{
2014-03-14 06:36:05 +00:00
this.game.physics.arcade.updateMotion(this);
this.newVelocity.set(this.velocity.x * this.game.time.physicsElapsed, this.velocity.y * this.game.time.physicsElapsed);
this.position.x += this.newVelocity.x;
this.position.y += this.newVelocity.y;
if (this.position.x !== this.prev.x || this.position.y !== this.prev.y)
{
this.angle = Math.atan2(this.velocity.y, this.velocity.x);
}
2016-04-22 14:15:28 +00:00
this.speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y);
2014-03-14 06:36:05 +00:00
// Now the State update will throw collision checks at the Body
// And finally we'll integrate the new position back to the Sprite in postUpdate
if (this.collideWorldBounds)
2014-02-21 15:37:26 +00:00
{
2016-07-08 14:46:26 +00:00
if (this.checkWorldBounds() & & this.onWorldBounds)
{
this.onWorldBounds.dispatch(this.sprite, this.blocked.up, this.blocked.down, this.blocked.left, this.blocked.right);
}
2014-02-21 15:37:26 +00:00
}
}
2013-10-25 15:54:40 +00:00
2014-03-28 01:42:49 +00:00
this._dx = this.deltaX();
this._dy = this.deltaY();
this._reset = false;
2014-02-21 15:37:26 +00:00
},
2013-10-25 16:30:37 +00:00
2016-06-17 00:11:24 +00:00
/**
* Internal method.
*
* @method Phaser.Physics.Arcade.Body#updateMovement
* @protected
*/
updateMovement: function () {
var percent = 0;
var collided = (this.overlapX !== 0 || this.overlapY !== 0);
// Duration or Distance based?
if (this.moveDuration > 0)
{
this.moveTimer += this.game.time.elapsedMS;
percent = this.moveTimer / this.moveDuration;
}
else
{
this.moveTarget.end.set(this.position.x, this.position.y);
percent = this.moveTarget.length / this.moveDistance;
}
if (this.movementCallback)
{
var result = this.movementCallback.call(this.movementCallbackContext, this, this.velocity, percent);
}
if (collided || percent >= 1 || (result !== undefined & & result !== true))
{
this.stopMovement((percent >= 1) || (this.stopVelocityOnCollide & & collided));
return false;
}
return true;
},
/**
* If this Body is moving as a result of a call to `moveTo` or `moveFrom` (i.e. it
* has Body.isMoving true), then calling this method will stop the movement before
* either the duration or distance counters expire.
*
* The `onMoveComplete` signal is dispatched.
*
* @method Phaser.Physics.Arcade.Body#stopMovement
* @param {boolean} [stopVelocity] - Should the Body.velocity be set to zero?
*/
stopMovement: function (stopVelocity) {
if (this.isMoving)
{
this.isMoving = false;
if (stopVelocity)
{
this.velocity.set(0);
}
// Send the Sprite this Body belongs to
// and a boolean indicating if it stopped because of a collision or not
this.onMoveComplete.dispatch(this.sprite, (this.overlapX !== 0 || this.overlapY !== 0));
}
},
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* Internal method.
2014-02-21 15:37:26 +00:00
*
2014-04-10 22:13:43 +00:00
* @method Phaser.Physics.Arcade.Body#postUpdate
2014-03-14 06:36:05 +00:00
* @protected
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
postUpdate: function () {
2013-10-25 16:30:37 +00:00
2014-04-15 14:39:23 +00:00
// Only allow postUpdate to be called once per frame
2015-03-23 23:46:30 +00:00
if (!this.enable || !this.dirty)
2014-04-15 14:39:23 +00:00
{
return;
}
2016-06-17 00:11:24 +00:00
// Moving?
if (this.isMoving)
{
this.updateMovement();
}
2015-03-23 23:46:30 +00:00
this.dirty = false;
2014-03-28 01:42:49 +00:00
2014-03-14 06:36:05 +00:00
if (this.deltaX() < 0)
2014-02-21 15:37:26 +00:00
{
2014-03-14 06:36:05 +00:00
this.facing = Phaser.LEFT;
2014-02-21 15:37:26 +00:00
}
2014-03-14 06:36:05 +00:00
else if (this.deltaX() > 0)
2014-02-21 15:37:26 +00:00
{
2014-03-14 06:36:05 +00:00
this.facing = Phaser.RIGHT;
}
2013-10-25 16:30:37 +00:00
2014-03-14 06:36:05 +00:00
if (this.deltaY() < 0)
{
this.facing = Phaser.UP;
}
else if (this.deltaY() > 0)
{
this.facing = Phaser.DOWN;
2014-02-21 15:37:26 +00:00
}
2013-10-25 15:54:40 +00:00
2014-03-14 06:36:05 +00:00
if (this.moves)
{
2014-03-24 12:41:45 +00:00
this._dx = this.deltaX();
this._dy = this.deltaY();
2015-03-23 23:46:30 +00:00
if (this.deltaMax.x !== 0 & & this._dx !== 0)
2014-03-24 12:41:45 +00:00
{
2015-03-23 23:46:30 +00:00
if (this._dx < 0 & & this._dx < -this.deltaMax.x)
2014-03-24 12:41:45 +00:00
{
this._dx = -this.deltaMax.x;
}
2015-03-23 23:46:30 +00:00
else if (this._dx > 0 & & this._dx > this.deltaMax.x)
2014-03-24 12:41:45 +00:00
{
this._dx = this.deltaMax.x;
}
}
2015-03-23 23:46:30 +00:00
if (this.deltaMax.y !== 0 & & this._dy !== 0)
2014-03-24 12:41:45 +00:00
{
2015-03-23 23:46:30 +00:00
if (this._dy < 0 & & this._dy < -this.deltaMax.y)
2014-03-24 12:41:45 +00:00
{
this._dy = -this.deltaMax.y;
}
2015-03-23 23:46:30 +00:00
else if (this._dy > 0 & & this._dy > this.deltaMax.y)
2014-03-24 12:41:45 +00:00
{
this._dy = this.deltaMax.y;
}
}
2015-03-23 23:46:30 +00:00
this.sprite.position.x += this._dx;
this.sprite.position.y += this._dy;
this._reset = true;
2014-03-14 06:36:05 +00:00
}
2014-03-24 12:41:45 +00:00
this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight);
2014-03-14 06:36:05 +00:00
if (this.allowRotation)
2014-02-21 15:37:26 +00:00
{
2014-03-14 06:36:05 +00:00
this.sprite.angle += this.deltaZ();
2014-02-21 15:37:26 +00:00
}
2013-10-25 16:30:37 +00:00
2014-03-24 12:41:45 +00:00
this.prev.x = this.position.x;
this.prev.y = this.position.y;
},
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* Internal method.
2014-02-21 15:37:26 +00:00
*
2014-04-10 22:13:43 +00:00
* @method Phaser.Physics.Arcade.Body#checkWorldBounds
2014-03-14 06:36:05 +00:00
* @protected
2016-07-08 14:46:26 +00:00
* @return {boolean} True if the Body collided with the world bounds, otherwise false.
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
checkWorldBounds: function () {
2013-10-25 16:30:37 +00:00
2015-07-22 14:31:30 +00:00
var pos = this.position;
var bounds = this.game.physics.arcade.bounds;
var check = this.game.physics.arcade.checkCollision;
2016-05-19 11:36:51 +00:00
var bx = (this.worldBounce) ? -this.worldBounce.x : -this.bounce.x;
var by = (this.worldBounce) ? -this.worldBounce.y : -this.bounce.y;
2016-07-08 14:46:26 +00:00
if (this.isCircle)
2014-02-21 15:37:26 +00:00
{
2016-07-08 14:46:26 +00:00
var bodyBounds = {
x: this.center.x - this.radius,
y: this.center.y - this.radius,
right: this.center.x + this.radius,
bottom: this.center.y + this.radius
};
if (bodyBounds.x < bounds.x & & check.left)
{
pos.x = bounds.x - this.halfWidth + this.radius;
this.velocity.x *= bx;
this.blocked.left = true;
}
else if (bodyBounds.right > bounds.right & & check.right)
{
pos.x = bounds.right - this.halfWidth - this.radius;
this.velocity.x *= bx;
this.blocked.right = true;
}
2013-10-25 16:30:37 +00:00
2016-07-08 14:46:26 +00:00
if (bodyBounds.y < bounds.y & & check.up)
{
pos.y = bounds.y - this.halfHeight + this.radius;
this.velocity.y *= by;
this.blocked.up = true;
}
else if (bodyBounds.bottom > bounds.bottom & & check.down)
{
pos.y = bounds.bottom - this.halfHeight - this.radius;
this.velocity.y *= by;
this.blocked.down = true;
}
2014-02-21 15:37:26 +00:00
}
2016-07-08 14:46:26 +00:00
else
2014-02-21 15:37:26 +00:00
{
2016-07-08 14:46:26 +00:00
if (pos.x < bounds.x & & check.left)
{
pos.x = bounds.x;
this.velocity.x *= bx;
this.blocked.left = true;
}
else if (this.right > bounds.right & & check.right)
{
pos.x = bounds.right - this.width;
this.velocity.x *= bx;
this.blocked.right = true;
}
if (pos.y < bounds.y & & check.up)
{
pos.y = bounds.y;
this.velocity.y *= by;
this.blocked.up = true;
}
else if (this.bottom > bounds.bottom & & check.down)
{
pos.y = bounds.bottom - this.height;
this.velocity.y *= by;
this.blocked.down = true;
}
2014-02-21 15:37:26 +00:00
}
2013-10-25 16:30:37 +00:00
2016-07-08 14:46:26 +00:00
return (this.blocked.up || this.blocked.down || this.blocked.left || this.blocked.right);
2014-02-21 15:37:26 +00:00
},
2013-10-25 15:54:40 +00:00
2016-06-17 00:11:24 +00:00
/**
* Note: This method is experimental, and may be changed or removed in a future release.
*
* This method moves the Body in the given direction, for the duration specified.
* It works by setting the velocity on the Body, and an internal timer, and then
* monitoring the duration each frame. When the duration is up the movement is
* stopped and the `Body.onMoveComplete` signal is dispatched.
*
* Movement also stops if the Body collides or overlaps with any other Body.
*
* You can control if the velocity should be reset to zero on collision, by using
* the property `Body.stopVelocityOnCollide`.
*
* Stop the movement at any time by calling `Body.stopMovement`.
*
* You can optionally set a speed in pixels per second. If not specified it
* will use the current `Body.speed` value. If this is zero, the function will return false.
*
* Please note that due to browser timings you should allow for a variance in
* when the duration will actually expire. Depending on system it may be as much as
* +- 50ms. Also this method doesn't take into consideration any other forces acting
* on the Body, such as Gravity, drag or maxVelocity, all of which may impact the
* movement.
*
* @method Phaser.Physics.Arcade.Body#moveFrom
* @param {integer} duration - The duration of the movement, in ms.
* @param {integer} [speed] - The speed of the movement, in pixels per second. If not provided `Body.speed` is used.
* @param {integer} [direction] - The angle of movement. If not provided `Body.angle` is used.
* @return {boolean} True if the movement successfully started, otherwise false.
*/
moveFrom: function (duration, speed, direction) {
if (speed === undefined) { speed = this.speed; }
if (speed === 0)
{
return false;
}
var angle;
if (direction === undefined)
{
angle = this.angle;
direction = this.game.math.radToDeg(angle);
}
else
{
angle = this.game.math.degToRad(direction);
}
this.moveTimer = 0;
this.moveDuration = duration;
// Avoid sin/cos
if (direction === 0 || direction === 180)
{
this.velocity.set(Math.cos(angle) * speed, 0);
}
else if (direction === 90 || direction === 270)
{
this.velocity.set(0, Math.sin(angle) * speed);
}
else
{
this.velocity.set(Math.cos(angle) * speed, Math.sin(angle) * speed);
}
this.isMoving = true;
return true;
},
/**
* Note: This method is experimental, and may be changed or removed in a future release.
*
* This method moves the Body in the given direction, for the duration specified.
* It works by setting the velocity on the Body, and an internal distance counter.
* The distance is monitored each frame. When the distance equals the distance
* specified in this call, the movement is stopped, and the `Body.onMoveComplete`
* signal is dispatched.
*
* Movement also stops if the Body collides or overlaps with any other Body.
*
* You can control if the velocity should be reset to zero on collision, by using
* the property `Body.stopVelocityOnCollide`.
*
* Stop the movement at any time by calling `Body.stopMovement`.
*
* Please note that due to browser timings you should allow for a variance in
* when the distance will actually expire.
*
* Note: This method doesn't take into consideration any other forces acting
* on the Body, such as Gravity, drag or maxVelocity, all of which may impact the
* movement.
*
* @method Phaser.Physics.Arcade.Body#moveTo
* @param {integer} duration - The duration of the movement, in ms.
* @param {integer} distance - The distance, in pixels, the Body will move.
* @param {integer} [direction] - The angle of movement. If not provided `Body.angle` is used.
* @return {boolean} True if the movement successfully started, otherwise false.
*/
moveTo: function (duration, distance, direction) {
var speed = distance / (duration / 1000);
if (speed === 0)
{
return false;
}
var angle;
if (direction === undefined)
{
angle = this.angle;
direction = this.game.math.radToDeg(angle);
}
else
{
angle = this.game.math.degToRad(direction);
}
distance = Math.abs(distance);
this.moveDuration = 0;
this.moveDistance = distance;
if (this.moveTarget === null)
{
this.moveTarget = new Phaser.Line();
this.moveEnd = new Phaser.Point();
}
this.moveTarget.fromAngle(this.x, this.y, angle, distance);
this.moveEnd.set(this.moveTarget.end.x, this.moveTarget.end.y);
this.moveTarget.setTo(this.x, this.y, this.x, this.y);
// Avoid sin/cos
if (direction === 0 || direction === 180)
{
this.velocity.set(Math.cos(angle) * speed, 0);
}
else if (direction === 90 || direction === 270)
{
this.velocity.set(0, Math.sin(angle) * speed);
}
else
{
this.velocity.set(Math.cos(angle) * speed, Math.sin(angle) * speed);
}
this.isMoving = true;
return true;
},
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* You can modify the size of the physics Body to be any dimension you need.
2016-06-03 17:48:34 +00:00
* This allows you to make it smaller, or larger, than the parent Sprite.
* You can also control the x and y offset of the Body. This is the position of the
* Body relative to the top-left of the Sprite _texture_.
*
* For example: If you have a Sprite with a texture that is 80x100 in size,
* and you want the physics body to be 32x32 pixels in the middle of the texture, you would do:
*
* `setSize(32, 32, 24, 34)`
2014-02-21 15:37:26 +00:00
*
2016-06-03 17:48:34 +00:00
* Where the first two parameters is the new Body size (32x32 pixels).
* 24 is the horizontal offset of the Body from the top-left of the Sprites texture, and 34
* is the vertical offset.
2016-04-22 14:15:28 +00:00
*
2016-07-08 14:46:26 +00:00
* Calling `setSize` on a Body that has already had `setCircle` will reset all of the Circle
* properties, making this Body rectangular again.
*
2014-04-10 22:13:43 +00:00
* @method Phaser.Physics.Arcade.Body#setSize
2014-03-14 06:36:05 +00:00
* @param {number} width - The width of the Body.
* @param {number} height - The height of the Body.
2016-06-03 17:48:34 +00:00
* @param {number} [offsetX] - The X offset of the Body from the top-left of the Sprites texture.
* @param {number} [offsetY] - The Y offset of the Body from the top-left of the Sprites texture.
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
setSize: function (width, height, offsetX, offsetY) {
2013-10-25 16:30:37 +00:00
2015-07-22 14:31:30 +00:00
if (offsetX === undefined) { offsetX = this.offset.x; }
if (offsetY === undefined) { offsetY = this.offset.y; }
2014-03-14 06:36:05 +00:00
this.sourceWidth = width;
this.sourceHeight = height;
this.width = this.sourceWidth * this._sx;
this.height = this.sourceHeight * this._sy;
this.halfWidth = Math.floor(this.width / 2);
this.halfHeight = Math.floor(this.height / 2);
this.offset.setTo(offsetX, offsetY);
2014-03-24 12:41:45 +00:00
this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight);
2013-10-25 15:54:40 +00:00
2016-07-08 14:46:26 +00:00
this.isCircle = false;
this.radius = 0;
},
/**
* Sets this Body as using a circle, of the given radius, for all collision detection instead of a rectangle.
* The radius is given in pixels and is the distance from the center of the circle to the edge.
*
* You can also control the x and y offset, which is the position of the Body relative to the top-left of the Sprite.
*
* To change a Body back to being rectangular again call `Body.setSize`.
*
* Note: Circular collision only happens with other Arcade Physics bodies, it does not
* work against tile maps, where rectangular collision is the only method supported.
*
* @method Phaser.Physics.Arcade.Body#setCircle
* @param {number} [radius] - The radius of the Body in pixels. Pass a value of zero / undefined, to stop the Body using a circle for collision.
* @param {number} [offsetX] - The X offset of the Body from the Sprite position.
* @param {number} [offsetY] - The Y offset of the Body from the Sprite position.
*/
setCircle: function (radius, offsetX, offsetY) {
if (offsetX === undefined) { offsetX = this.offset.x; }
if (offsetY === undefined) { offsetY = this.offset.y; }
if (radius > 0)
{
this.isCircle = true;
this.radius = radius;
this.sourceWidth = radius * 2;
this.sourceHeight = radius * 2;
this.width = this.sourceWidth * this._sx;
this.height = this.sourceHeight * this._sy;
this.halfWidth = Math.floor(this.width / 2);
this.halfHeight = Math.floor(this.height / 2);
this.offset.setTo(offsetX, offsetY);
this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight);
}
else
{
this.isCircle = false;
}
2014-02-21 15:37:26 +00:00
},
2013-10-25 15:54:40 +00:00
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* Resets all Body values (velocity, acceleration, rotation, etc)
2014-02-21 15:37:26 +00:00
*
2014-04-10 22:13:43 +00:00
* @method Phaser.Physics.Arcade.Body#reset
2014-03-14 06:36:05 +00:00
* @param {number} x - The new x position of the Body.
2014-04-10 22:13:43 +00:00
* @param {number} y - The new y position of the Body.
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
reset: function (x, y) {
2014-02-05 06:29:17 +00:00
2014-03-24 12:41:45 +00:00
this.velocity.set(0);
this.acceleration.set(0);
2014-03-14 06:36:05 +00:00
2015-03-23 23:46:30 +00:00
this.speed = 0;
2014-03-14 06:36:05 +00:00
this.angularVelocity = 0;
this.angularAcceleration = 0;
2016-06-03 17:48:34 +00:00
this.position.x = (x - (this.sprite.anchor.x * this.sprite.width)) + this.sprite.scale.x * this.offset.x;
this.position.x -= this.sprite.scale.x < 0 ? this.width : 0;
this.position.y = (y - (this.sprite.anchor.y * this.sprite.height)) + this.sprite.scale.y * this.offset.y;
this.position.y -= this.sprite.scale.y < 0 ? this.height : 0;
2014-03-24 12:41:45 +00:00
this.prev.x = this.position.x;
this.prev.y = this.position.y;
this.rotation = this.sprite.angle;
2014-03-14 06:36:05 +00:00
this.preRotation = this.rotation;
2014-03-24 12:41:45 +00:00
this._sx = this.sprite.scale.x;
this._sy = this.sprite.scale.y;
2014-07-10 19:31:11 +00:00
2014-03-24 12:41:45 +00:00
this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight);
2014-02-05 06:29:17 +00:00
2014-02-21 15:37:26 +00:00
},
2014-02-05 06:29:17 +00:00
2016-07-08 14:46:26 +00:00
/**
* Returns the bounds of this physics body.
*
* Only used internally by the World collision methods.
*
* @method Phaser.Physics.Arcade.Body#getBounds
* @param {object} obj - The object in which to set the bounds values.
* @return {object} The object that was given to this method.
*/
getBounds: function (obj) {
if (this.isCircle)
{
obj.x = this.center.x - this.radius;
obj.y = this.center.y - this.radius;
obj.right = this.center.x + this.radius;
obj.bottom = this.center.y + this.radius;
}
else
{
obj.x = this.x;
obj.y = this.y;
obj.right = this.right;
obj.bottom = this.bottom;
}
return obj;
},
2014-04-10 22:13:43 +00:00
/**
* Tests if a world point lies within this Body.
*
* @method Phaser.Physics.Arcade.Body#hitTest
* @param {number} x - The world x coordinate to test.
* @param {number} y - The world y coordinate to test.
* @return {boolean} True if the given coordinates are inside this Body, otherwise false.
*/
hitTest: function (x, y) {
2016-04-22 14:15:28 +00:00
2016-07-08 14:46:26 +00:00
return (this.isCircle) ? Phaser.Circle.contains(this, x, y) : Phaser.Rectangle.contains(this, x, y);
2016-04-22 14:15:28 +00:00
2014-04-10 22:13:43 +00:00
},
2014-02-05 06:29:17 +00:00
/**
2014-03-14 06:36:05 +00:00
* Returns true if the bottom of this Body is in contact with either the world bounds or a tile.
2014-02-21 15:37:26 +00:00
*
2014-03-14 06:36:05 +00:00
* @method Phaser.Physics.Arcade.Body#onFloor
* @return {boolean} True if in contact with either the world bounds or a tile.
2014-02-05 06:29:17 +00:00
*/
2014-03-14 06:36:05 +00:00
onFloor: function () {
2016-04-22 14:15:28 +00:00
2014-03-14 06:36:05 +00:00
return this.blocked.down;
2016-04-22 14:15:28 +00:00
2014-02-21 15:37:26 +00:00
},
2016-02-08 17:01:36 +00:00
/**
* Returns true if the top of this Body is in contact with either the world bounds or a tile.
*
* @method Phaser.Physics.Arcade.Body#onTop
* @return {boolean} True if in contact with either the world bounds or a tile.
*/
onCeiling: function(){
2016-04-22 14:15:28 +00:00
2016-02-08 17:01:36 +00:00
return this.blocked.up;
2016-04-22 14:15:28 +00:00
2016-02-08 17:01:36 +00:00
},
2014-02-05 06:29:17 +00:00
/**
2014-03-14 06:36:05 +00:00
* Returns true if either side of this Body is in contact with either the world bounds or a tile.
2014-02-21 15:37:26 +00:00
*
2014-03-14 06:36:05 +00:00
* @method Phaser.Physics.Arcade.Body#onWall
* @return {boolean} True if in contact with either the world bounds or a tile.
2014-02-05 06:29:17 +00:00
*/
2014-03-14 06:36:05 +00:00
onWall: function () {
2016-04-22 14:15:28 +00:00
2014-03-14 06:36:05 +00:00
return (this.blocked.left || this.blocked.right);
2016-04-22 14:15:28 +00:00
2014-02-21 15:37:26 +00:00
},
2013-10-25 15:54:40 +00:00
2014-02-21 15:37:26 +00:00
/**
2014-03-14 06:36:05 +00:00
* Returns the absolute delta x value.
2014-02-21 15:37:26 +00:00
*
2014-03-14 06:36:05 +00:00
* @method Phaser.Physics.Arcade.Body#deltaAbsX
* @return {number} The absolute delta value.
2014-02-21 15:37:26 +00:00
*/
2014-03-14 06:36:05 +00:00
deltaAbsX: function () {
2016-04-22 14:15:28 +00:00
2014-03-14 06:36:05 +00:00
return (this.deltaX() > 0 ? this.deltaX() : -this.deltaX());
2016-04-22 14:15:28 +00:00
2014-02-21 15:37:26 +00:00
},
2013-10-25 15:54:40 +00:00
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* Returns the absolute delta y value.
2013-10-25 16:30:37 +00:00
*
2014-03-14 06:36:05 +00:00
* @method Phaser.Physics.Arcade.Body#deltaAbsY
* @return {number} The absolute delta value.
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
deltaAbsY: function () {
2016-04-22 14:15:28 +00:00
2014-03-14 06:36:05 +00:00
return (this.deltaY() > 0 ? this.deltaY() : -this.deltaY());
2016-04-22 14:15:28 +00:00
2013-11-28 15:57:09 +00:00
},
2013-10-25 15:54:40 +00:00
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* Returns the delta x value. The difference between Body.x now and in the previous step.
2013-10-25 16:30:37 +00:00
*
2014-03-14 06:36:05 +00:00
* @method Phaser.Physics.Arcade.Body#deltaX
* @return {number} The delta value. Positive if the motion was to the right, negative if to the left.
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
deltaX: function () {
2016-04-22 14:15:28 +00:00
2014-03-14 06:36:05 +00:00
return this.position.x - this.prev.x;
2016-04-22 14:15:28 +00:00
2014-02-21 15:37:26 +00:00
},
2014-02-08 07:24:22 +00:00
2014-02-21 15:37:26 +00:00
/**
2014-03-14 06:36:05 +00:00
* Returns the delta y value. The difference between Body.y now and in the previous step.
2014-02-21 15:37:26 +00:00
*
2014-03-14 06:36:05 +00:00
* @method Phaser.Physics.Arcade.Body#deltaY
* @return {number} The delta value. Positive if the motion was downwards, negative if upwards.
2014-02-21 15:37:26 +00:00
*/
2014-03-14 06:36:05 +00:00
deltaY: function () {
2016-04-22 14:15:28 +00:00
2014-03-14 06:36:05 +00:00
return this.position.y - this.prev.y;
2016-04-22 14:15:28 +00:00
2014-02-21 15:37:26 +00:00
},
2014-02-05 06:29:17 +00:00
2014-02-21 15:37:26 +00:00
/**
2014-03-14 06:36:05 +00:00
* Returns the delta z value. The difference between Body.rotation now and in the previous step.
2014-02-21 15:37:26 +00:00
*
2014-03-14 06:36:05 +00:00
* @method Phaser.Physics.Arcade.Body#deltaZ
* @return {number} The delta value. Positive if the motion was clockwise, negative if anti-clockwise.
2014-02-21 15:37:26 +00:00
*/
2014-03-14 06:36:05 +00:00
deltaZ: function () {
2016-04-22 14:15:28 +00:00
2014-03-14 06:36:05 +00:00
return this.rotation - this.preRotation;
2016-04-22 14:15:28 +00:00
},
/**
* Destroys this Body.
*
* First it calls Group.removeFromHash if the Game Object this Body belongs to is part of a Group.
* Then it nulls the Game Objects body reference, and nulls this Body.sprite reference.
*
* @method Phaser.Physics.Arcade.Body#destroy
*/
destroy: function () {
if (this.sprite.parent & & this.sprite.parent instanceof Phaser.Group)
{
this.sprite.parent.removeFromHash(this.sprite);
}
this.sprite.body = null;
this.sprite = null;
2014-03-14 06:36:05 +00:00
}
2013-10-25 15:54:40 +00:00
2014-03-14 06:36:05 +00:00
};
2014-02-05 06:29:17 +00:00
2014-02-21 15:37:26 +00:00
/**
2016-04-22 14:15:28 +00:00
* @name Phaser.Physics.Arcade.Body#left
* @property {number} left - The x position of the Body. The same as `Body.x`.
2014-02-21 15:37:26 +00:00
*/
2016-04-22 14:15:28 +00:00
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "left", {
2014-03-28 01:42:49 +00:00
2014-02-21 15:37:26 +00:00
get: function () {
2016-04-22 14:15:28 +00:00
return this.position.x;
2014-02-21 15:37:26 +00:00
}
});
/**
2014-03-14 06:36:05 +00:00
* @name Phaser.Physics.Arcade.Body#right
* @property {number} right - The right value of this Body (same as Body.x + Body.width)
* @readonly
2014-02-21 15:37:26 +00:00
*/
2014-03-14 06:36:05 +00:00
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "right", {
2014-03-28 01:42:49 +00:00
2014-02-21 15:37:26 +00:00
get: function () {
2016-04-22 14:15:28 +00:00
2014-03-14 06:36:05 +00:00
return this.position.x + this.width;
2016-04-22 14:15:28 +00:00
}
});
/**
* @name Phaser.Physics.Arcade.Body#top
* @property {number} top - The y position of the Body. The same as `Body.y`.
*/
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "top", {
get: function () {
return this.position.y;
}
});
/**
* @name Phaser.Physics.Arcade.Body#bottom
* @property {number} bottom - The bottom value of this Body (same as Body.y + Body.height)
* @readonly
*/
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "bottom", {
get: function () {
return this.position.y + this.height;
2014-02-21 15:37:26 +00:00
}
});
/**
2014-03-14 06:36:05 +00:00
* @name Phaser.Physics.Arcade.Body#x
* @property {number} x - The x position.
2014-02-21 15:37:26 +00:00
*/
2014-03-14 06:36:05 +00:00
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "x", {
2014-03-28 01:42:49 +00:00
2014-02-21 15:37:26 +00:00
get: function () {
2016-04-22 14:15:28 +00:00
2014-03-14 06:36:05 +00:00
return this.position.x;
2016-04-22 14:15:28 +00:00
2014-02-21 15:37:26 +00:00
},
set: function (value) {
2014-03-28 01:42:49 +00:00
2014-03-14 06:36:05 +00:00
this.position.x = value;
2014-02-21 15:37:26 +00:00
}
});
2014-02-05 06:29:17 +00:00
2014-02-21 15:37:26 +00:00
/**
2014-03-14 06:36:05 +00:00
* @name Phaser.Physics.Arcade.Body#y
* @property {number} y - The y position.
2014-02-21 15:37:26 +00:00
*/
2014-03-14 06:36:05 +00:00
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "y", {
2014-03-28 01:42:49 +00:00
2014-02-21 15:37:26 +00:00
get: function () {
2016-04-22 14:15:28 +00:00
2014-03-14 06:36:05 +00:00
return this.position.y;
2016-04-22 14:15:28 +00:00
2014-02-05 06:29:17 +00:00
},
2014-02-21 15:37:26 +00:00
set: function (value) {
2014-03-28 01:42:49 +00:00
2014-03-14 06:36:05 +00:00
this.position.y = value;
2014-03-28 01:42:49 +00:00
2013-10-25 15:54:40 +00:00
}
2014-02-21 15:37:26 +00:00
});
/**
2014-03-14 06:36:05 +00:00
* Render Sprite Body.
*
2014-07-10 19:31:11 +00:00
* @method Phaser.Physics.Arcade.Body#render
2014-03-14 06:36:05 +00:00
* @param {object} context - The context to render to.
* @param {Phaser.Physics.Arcade.Body} body - The Body to render the info of.
2014-07-10 19:31:11 +00:00
* @param {string} [color='rgba(0,255,0,0.4)'] - color of the debug info to be rendered. (format is css color string).
2014-03-14 06:36:05 +00:00
* @param {boolean} [filled=true] - Render the objected as a filled (default, true) or a stroked (false)
2014-02-21 15:37:26 +00:00
*/
2014-07-10 19:31:11 +00:00
Phaser.Physics.Arcade.Body.render = function (context, body, color, filled) {
2014-02-21 15:37:26 +00:00
2015-07-22 14:31:30 +00:00
if (filled === undefined) { filled = true; }
2014-02-21 15:37:26 +00:00
2014-03-14 06:36:05 +00:00
color = color || 'rgba(0,255,0,0.4)';
2014-02-21 15:37:26 +00:00
2016-07-08 14:46:26 +00:00
context.fillStyle = color;
context.strokeStyle = color;
if (body.isCircle)
2014-03-14 06:36:05 +00:00
{
2016-07-08 14:46:26 +00:00
context.beginPath();
context.arc(body.center.x - body.game.camera.x, body.center.y - body.game.camera.y, body.radius, 0, 2 * Math.PI);
if (filled)
{
context.fill();
}
else
{
context.stroke();
}
2014-02-21 15:37:26 +00:00
}
2014-03-14 06:36:05 +00:00
else
{
2016-07-08 14:46:26 +00:00
if (filled)
{
context.fillRect(body.position.x - body.game.camera.x, body.position.y - body.game.camera.y, body.width, body.height);
}
else
{
context.strokeRect(body.position.x - body.game.camera.x, body.position.y - body.game.camera.y, body.width, body.height);
}
2013-10-25 15:54:40 +00:00
}
2014-03-28 01:42:49 +00:00
};
2013-10-25 15:54:40 +00:00
2013-10-25 16:30:37 +00:00
/**
2014-03-14 06:36:05 +00:00
* Render Sprite Body Physics Data as text.
*
* @method Phaser.Physics.Arcade.Body#renderBodyInfo
* @param {Phaser.Physics.Arcade.Body} body - The Body to render the info of.
* @param {number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
2013-10-25 16:30:37 +00:00
*/
2014-03-14 06:36:05 +00:00
Phaser.Physics.Arcade.Body.renderBodyInfo = function (debug, body) {
2013-10-25 15:54:40 +00:00
2014-03-14 06:36:05 +00:00
debug.line('x: ' + body.x.toFixed(2), 'y: ' + body.y.toFixed(2), 'width: ' + body.width, 'height: ' + body.height);
2014-03-28 01:42:49 +00:00
debug.line('velocity x: ' + body.velocity.x.toFixed(2), 'y: ' + body.velocity.y.toFixed(2), 'deltaX: ' + body._dx.toFixed(2), 'deltaY: ' + body._dy.toFixed(2));
2014-03-14 06:36:05 +00:00
debug.line('acceleration x: ' + body.acceleration.x.toFixed(2), 'y: ' + body.acceleration.y.toFixed(2), 'speed: ' + body.speed.toFixed(2), 'angle: ' + body.angle.toFixed(2));
debug.line('gravity x: ' + body.gravity.x, 'y: ' + body.gravity.y, 'bounce x: ' + body.bounce.x.toFixed(2), 'y: ' + body.bounce.y.toFixed(2));
debug.line('touching left: ' + body.touching.left, 'right: ' + body.touching.right, 'up: ' + body.touching.up, 'down: ' + body.touching.down);
debug.line('blocked left: ' + body.blocked.left, 'right: ' + body.blocked.right, 'up: ' + body.blocked.up, 'down: ' + body.blocked.down);
2013-10-25 15:54:40 +00:00
2014-03-28 01:42:49 +00:00
};
2013-10-25 15:54:40 +00:00
2014-03-14 06:36:05 +00:00
Phaser.Physics.Arcade.Body.prototype.constructor = Phaser.Physics.Arcade.Body;
2013-10-25 15:54:40 +00:00
< / pre >
< / article >
< / section >
< / div >
< div class = "clearfix" > < / div >
< footer >
< span class = "copyright" >
2016-04-22 14:15:28 +00:00
Phaser Copyright © 2012-2016 Photon Storm Ltd.
2013-10-25 15:54:40 +00:00
< / span >
< br / >
< span class = "jsdoc-message" >
2016-06-17 11:46:47 +00:00
Documentation generated by < a href = "https://github.com/jsdoc3/jsdoc" > JSDoc 3.3.3< / a >
2016-07-11 09:11:09 +00:00
on Mon Jul 11 2016 10:10:43 GMT+0100 (GMT Daylight Time) using the < a href = "https://github.com/terryweiss/docstrap" > DocStrap template< / a > .
2013-10-25 15:54:40 +00:00
< / span >
< / footer >
< / div >
< br clear = "both" >
< / div >
< / div >
< script src = "scripts/sunlight.js" > < / script >
< script src = "scripts/sunlight.javascript.js" > < / script >
< script src = "scripts/sunlight-plugin.doclinks.js" > < / script >
< script src = "scripts/sunlight-plugin.linenumbers.js" > < / script >
< script src = "scripts/sunlight-plugin.menu.js" > < / script >
< script src = "scripts/jquery.min.js" > < / script >
< script src = "scripts/jquery.scrollTo.js" > < / script >
< script src = "scripts/jquery.localScroll.js" > < / script >
< script src = "scripts/bootstrap-dropdown.js" > < / script >
< script src = "scripts/toc.js" > < / script >
< script > Sunlight . highlightAll ( { lineNumbers : true , showMenu : true , enableDoclinks : true } ) ; < / script >
< script >
$( function () {
$( "#toc" ).toc( {
2014-04-10 22:13:43 +00:00
anchorName : function(i, heading, prefix) {
2014-03-14 06:36:05 +00:00
return $(heading).attr("id") || ( prefix + i );
},
2013-10-25 15:54:40 +00:00
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : 60
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
} );
< / script >
< / body >
< / html >