2013-11-28 15:57:09 +00:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
< title > Phaser Source: tilemap/TilemapLayer.js< / title >
<!-- [if lt IE 9]>
< script src = "//html5shiv.googlecode.com/svn/trunk/html5.js" > < / script >
<![endif]-->
< link type = "text/css" rel = "stylesheet" href = "styles/sunlight.default.css" >
< link type = "text/css" rel = "stylesheet" href = "styles/site.cerulean.css" >
< / head >
< body >
< div class = "container-fluid" >
< div class = "navbar navbar-fixed-top navbar-inverse" >
< div class = "navbar-inner" >
< a class = "brand" href = "index.html" > Phaser< / a >
< ul class = "nav" >
< 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-11-28 15:57:09 +00:00
< a href = "Phaser.html" > Phaser< / a >
< / li >
< / 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-11-28 15:57:09 +00:00
< a href = "Phaser.Animation.html" > Animation< / 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.AnimationManager.html" > AnimationManager< / 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.AnimationParser.html" > AnimationParser< / a >
< / li >
2014-04-29 14:39:02 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ArrayList.html" > ArrayList< / 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-11-28 15:57:09 +00:00
< a href = "Phaser.BitmapText.html" > BitmapText< / 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.Button.html" > Button< / 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.Cache.html" > Cache< / 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.Camera.html" > Camera< / 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.Canvas.html" > Canvas< / 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.Circle.html" > Circle< / 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.Color.html" > Color< / 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.Device.html" > Device< / 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.Easing.html" > Easing< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Easing.Back.html" > Back< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Easing.Bounce.html" > Bounce< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Easing.Circular.html" > Circular< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Easing.Cubic.html" > Cubic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Easing.Elastic.html" > Elastic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Easing.Exponential.html" > Exponential< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Easing.Linear.html" > Linear< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Easing.Quadratic.html" > Quadratic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Easing.Quartic.html" > Quartic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Easing.Quintic.html" > Quintic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Easing.Sinusoidal.html" > Sinusoidal< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-18 03:01:51 +00:00
< a href = "Phaser.Ellipse.html" > Ellipse< / 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.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-11-28 15:57:09 +00:00
< a href = "Phaser.Frame.html" > Frame< / 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.FrameData.html" > FrameData< / 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.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-11-28 15:57:09 +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" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.GamepadButton.html" > GamepadButton< / 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.Graphics.html" > Graphics< / 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.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 >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Input.html" > Input< / 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.InputHandler.html" > InputHandler< / 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.Key.html" > Key< / 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.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-11-28 15:57:09 +00:00
< a href = "Phaser.LinkedList.html" > LinkedList< / 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.Loader.html" > Loader< / 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.LoaderParser.html" > LoaderParser< / 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.Math.html" > Math< / 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.Mouse.html" > Mouse< / 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.MSPointer.html" > MSPointer< / 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.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-11-28 15:57:09 +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-11-28 15:57:09 +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-11-28 15:57:09 +00:00
< a href = "Phaser.Physics.html" > Physics< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +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 >
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 >
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.Ninja.Tile.html" > Tile< / a >
2014-02-21 15:37:26 +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.P2.html" > P2< / 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.Body.html" > Body< / 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.BodyDebug.html" > BodyDebug< / 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.CollisionGroup.html" > CollisionGroup< / 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.ContactMaterial.html" > ContactMaterial< / 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.DistanceConstraint.html" > DistanceConstraint< / a >
< / 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 >
< / 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 >
< / 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 >
< / 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 >
< / 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 >
< / 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 >
< / 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 >
2014-02-21 15:37:26 +00:00
< / 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.Plugin.html" > Plugin< / 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.PluginManager.html" > PluginManager< / 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.Point.html" > Point< / 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.Pointer.html" > Pointer< / 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.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-11-28 15:57:09 +00:00
< a href = "Phaser.RandomDataGenerator.html" > RandomDataGenerator< / 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.Rectangle.html" > Rectangle< / 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.RenderTexture.html" > RenderTexture< / 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.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 >
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-11-28 15:57:09 +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-11-28 15:57:09 +00:00
< a href = "Phaser.Sound.html" > Sound< / 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.SoundManager.html" > SoundManager< / 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.Sprite.html" > Sprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-18 03:01:51 +00:00
< a href = "Phaser.SpriteBatch.html" > SpriteBatch< / 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.Stage.html" > Stage< / 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.State.html" > State< / 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.StateManager.html" > StateManager< / 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.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-11-28 15:57:09 +00:00
< a href = "Phaser.TileSprite.html" > TileSprite< / 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.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-11-28 15:57:09 +00:00
< a href = "Phaser.Touch.html" > Touch< / 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.Tween.html" > Tween< / 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.TweenManager.html" > TweenManager< / 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.Utils.html" > Utils< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Utils.Debug.html" > Debug< / 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.World.html" > World< / a >
< / li >
< / ul >
< / li >
2014-09-09 14:36:56 +00:00
2013-11-28 15:57:09 +00:00
< / ul >
< / div >
< / div >
< div class = "row-fluid" >
< div class = "span12" >
< div id = "main" >
< h1 class = "page-title" > Source: tilemap/TilemapLayer.js< / h1 >
< section >
< article >
< pre class = "sunlight-highlight-javascript linenums" > /**
* @author Richard Davey < rich@photonstorm.com>
2014-02-05 06:29:17 +00:00
* @copyright 2014 Photon Storm Ltd.
2013-11-28 15:57:09 +00:00
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* A Tilemap Layer is a set of map data combined with a Tileset in order to render that data to the game.
*
* @class Phaser.TilemapLayer
* @constructor
* @param {Phaser.Game} game - Game reference to the currently running game.
* @param {Phaser.Tilemap} tilemap - The tilemap to which this layer belongs.
2014-02-05 06:29:17 +00:00
* @param {number} index - The layer index within the map that this TilemapLayer represents.
* @param {number} width - Width of the renderable area of the layer.
* @param {number} height - Height of the renderable area of the layer.
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
Phaser.TilemapLayer = function (game, tilemap, index, width, height) {
2013-11-28 15:57:09 +00:00
/**
* @property {Phaser.Game} game - A reference to the currently running Game.
*/
this.game = game;
2014-02-05 06:29:17 +00:00
/**
* @property {Phaser.Tilemap} map - The Tilemap to which this layer is bound.
*/
this.map = tilemap;
2013-11-28 15:57:09 +00:00
/**
2014-02-05 06:29:17 +00:00
* @property {number} index - The index of this layer within the Tilemap.
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
this.index = index;
/**
* @property {object} layer - The layer object within the Tilemap that this layer represents.
*/
this.layer = tilemap.layers[index];
/**
* @property {HTMLCanvasElement} canvas - The canvas to which this TilemapLayer draws.
*/
2014-03-14 06:36:05 +00:00
this.canvas = Phaser.Canvas.create(width, height, '', true);
2014-03-24 12:41:45 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {CanvasRenderingContext2D} context - The 2d context of the canvas.
*/
this.context = this.canvas.getContext('2d');
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {PIXI.BaseTexture} baseTexture - Required Pixi var.
*/
this.baseTexture = new PIXI.BaseTexture(this.canvas);
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {PIXI.Texture} texture - Required Pixi var.
*/
this.texture = new PIXI.Texture(this.baseTexture);
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {Phaser.Frame} textureFrame - Dimensions of the renderable area.
*/
2014-02-05 06:29:17 +00:00
this.textureFrame = new Phaser.Frame(0, 0, 0, width, height, 'tilemapLayer', game.rnd.uuid());
2014-03-14 06:36:05 +00:00
Phaser.Image.call(this, this.game, 0, 0, this.texture, this.textureFrame);
2013-11-28 15:57:09 +00:00
2014-02-05 06:29:17 +00:00
/**
* @property {string} name - The name of the layer.
*/
this.name = '';
2013-11-28 15:57:09 +00:00
/**
* @property {number} type - The const type of this object.
* @default
*/
this.type = Phaser.TILEMAPLAYER;
/**
2014-02-05 06:29:17 +00:00
* An object that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera.
* @property {boolean} fixedToCamera - Fixes this object to the Camera.
2013-11-28 15:57:09 +00:00
* @default
*/
this.fixedToCamera = true;
/**
2014-02-05 06:29:17 +00:00
* @property {Phaser.Point} cameraOffset - If this object is fixed to the camera then use this Point to specify how far away from the Camera x/y it's rendered.
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
this.cameraOffset = new Phaser.Point(0, 0);
2013-11-28 15:57:09 +00:00
/**
2014-02-05 06:29:17 +00:00
* @property {string} tileColor - If no tileset is given the tiles will be rendered as rectangles in this color. Provide in hex or rgb/rgba string format.
* @default
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
this.tileColor = 'rgb(255, 255, 255)';
2013-11-28 15:57:09 +00:00
/**
2014-02-05 06:29:17 +00:00
* @property {boolean} debug - If set to true the collideable tile edges path will be rendered. Only works when game is running in Phaser.CANVAS mode.
* @default
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
this.debug = false;
2013-11-28 15:57:09 +00:00
/**
2014-02-05 06:29:17 +00:00
* @property {number} debugAlpha - If debug is true then the tileset is rendered with this alpha level, to make the tile edges clearer.
* @default
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
this.debugAlpha = 0.5;
2013-11-28 15:57:09 +00:00
/**
2014-02-05 06:29:17 +00:00
* @property {string} debugColor - If debug is true this is the color used to outline the edges of collidable tiles. Provide in hex or rgb/rgba string format.
* @default
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
this.debugColor = 'rgba(0, 255, 0, 1)';
2013-11-28 15:57:09 +00:00
/**
2014-02-05 06:29:17 +00:00
* @property {boolean} debugFill - If true the debug tiles are filled with debugFillColor AND stroked around.
* @default
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
this.debugFill = false;
2013-11-28 15:57:09 +00:00
/**
2014-02-05 06:29:17 +00:00
* @property {string} debugFillColor - If debugFill is true this is the color used to fill the tiles. Provide in hex or rgb/rgba string format.
* @default
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
this.debugFillColor = 'rgba(0, 255, 0, 0.2)';
2013-11-28 15:57:09 +00:00
/**
2014-02-05 06:29:17 +00:00
* @property {string} debugCallbackColor - If debug is true this is the color used to outline the edges of tiles that have collision callbacks. Provide in hex or rgb/rgba string format.
* @default
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
this.debugCallbackColor = 'rgba(255, 0, 0, 1)';
2013-11-28 15:57:09 +00:00
/**
2014-02-05 06:29:17 +00:00
* @property {number} scrollFactorX - speed at which this layer scrolls
* horizontally, relative to the camera (e.g. scrollFactorX of 0.5 scrolls
* half as quickly as the 'normal' camera-locked layers do)
* @default 1
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
this.scrollFactorX = 1;
/**
* @property {number} scrollFactorY - speed at which this layer scrolls
* vertically, relative to the camera (e.g. scrollFactorY of 0.5 scrolls
* half as quickly as the 'normal' camera-locked layers do)
* @default 1
*/
this.scrollFactorY = 1;
/**
* @property {boolean} dirty - Flag controlling when to re-render the layer.
*/
this.dirty = true;
2014-03-14 06:36:05 +00:00
/**
* @property {number} rayStepRate - When ray-casting against tiles this is the number of steps it will jump. For larger tile sizes you can increase this to improve performance.
* @default
*/
this.rayStepRate = 4;
2014-07-10 19:31:11 +00:00
/**
* @property {boolean} wrap - Flag controlling if the layer tiles wrap at the edges. Only works if the World size matches the Map size.
* @default false
*/
this.wrap = false;
2014-02-05 06:29:17 +00:00
/**
2014-03-24 12:41:45 +00:00
* @property {object} _mc - Local map data and calculation cache.
2014-03-28 01:42:49 +00:00
* @private
2013-11-28 15:57:09 +00:00
*/
2014-03-24 12:41:45 +00:00
this._mc = {
cw: tilemap.tileWidth,
ch: tilemap.tileHeight,
ga: 1,
dx: 0,
dy: 0,
dw: 0,
dh: 0,
tx: 0,
ty: 0,
tw: 0,
th: 0,
tl: 0,
maxX: 0,
maxY: 0,
startX: 0,
startY: 0,
x: 0,
y: 0,
prevX: 0,
prevY: 0
};
2013-11-28 15:57:09 +00:00
/**
* @property {array} _results - Local render loop var to help avoid gc spikes.
2014-03-28 01:42:49 +00:00
* @private
2013-11-28 15:57:09 +00:00
*/
this._results = [];
2014-02-05 06:29:17 +00:00
this.updateMax();
2013-11-28 15:57:09 +00:00
};
2014-03-14 06:36:05 +00:00
Phaser.TilemapLayer.prototype = Object.create(Phaser.Image.prototype);
2013-11-28 15:57:09 +00:00
Phaser.TilemapLayer.prototype.constructor = Phaser.TilemapLayer;
/**
2014-02-05 06:29:17 +00:00
* Automatically called by World.postUpdate. Handles cache updates.
2013-11-28 15:57:09 +00:00
*
2014-02-05 06:29:17 +00:00
* @method Phaser.TilemapLayer#postUpdate
2013-11-28 15:57:09 +00:00
* @memberof Phaser.TilemapLayer
*/
2014-02-05 06:29:17 +00:00
Phaser.TilemapLayer.prototype.postUpdate = function () {
2013-11-28 15:57:09 +00:00
2014-03-28 01:42:49 +00:00
Phaser.Image.prototype.postUpdate.call(this);
2014-02-05 06:29:17 +00:00
// Stops you being able to auto-scroll the camera if it's not following a sprite
2013-11-28 15:57:09 +00:00
this.scrollX = this.game.camera.x * this.scrollFactorX;
this.scrollY = this.game.camera.y * this.scrollFactorY;
this.render();
2014-03-24 12:41:45 +00:00
// Fixed to Camera?
if (this._cache[7] === 1)
{
this.position.x = (this.game.camera.view.x + this.cameraOffset.x) / this.game.camera.scale.x;
this.position.y = (this.game.camera.view.y + this.cameraOffset.y) / this.game.camera.scale.y;
}
// Update any Children
// for (var i = 0, len = this.children.length; i < len; i++)
// {
// this.children[i].postUpdate();
// }
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
/**
* Sets the world size to match the size of this layer.
*
* @method Phaser.TilemapLayer#resizeWorld
* @memberof Phaser.TilemapLayer
*/
Phaser.TilemapLayer.prototype.resizeWorld = function () {
2014-02-05 06:29:17 +00:00
this.game.world.setBounds(0, 0, this.layer.widthInPixels, this.layer.heightInPixels);
2013-11-28 15:57:09 +00:00
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2014-03-28 01:42:49 +00:00
* Take an x coordinate that doesn't account for scrollFactorX and 'fix' it
2013-11-28 15:57:09 +00:00
* into a scrolled local space. Used primarily internally
* @method Phaser.TilemapLayer#_fixX
* @memberof Phaser.TilemapLayer
* @private
* @param {number} x - x coordinate in camera space
* @return {number} x coordinate in scrollFactor-adjusted dimensions
*/
Phaser.TilemapLayer.prototype._fixX = function(x) {
2014-02-05 06:29:17 +00:00
if (x < 0)
{
x = 0;
}
2013-11-28 15:57:09 +00:00
if (this.scrollFactorX === 1)
{
return x;
}
2014-03-24 12:41:45 +00:00
return this._mc.x + (x - (this._mc.x / this.scrollFactorX));
2013-11-28 15:57:09 +00:00
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2014-03-28 01:42:49 +00:00
* Take an x coordinate that _does_ account for scrollFactorX and 'unfix' it
2013-11-28 15:57:09 +00:00
* back to camera space. Used primarily internally
* @method Phaser.TilemapLayer#_unfixX
* @memberof Phaser.TilemapLayer
* @private
* @param {number} x - x coordinate in scrollFactor-adjusted dimensions
* @return {number} x coordinate in camera space
*/
Phaser.TilemapLayer.prototype._unfixX = function(x) {
if (this.scrollFactorX === 1)
{
return x;
}
2014-03-24 12:41:45 +00:00
return (this._mc.x / this.scrollFactorX) + (x - this._mc.x);
2013-11-28 15:57:09 +00:00
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2014-03-28 01:42:49 +00:00
* Take a y coordinate that doesn't account for scrollFactorY and 'fix' it
2013-11-28 15:57:09 +00:00
* into a scrolled local space. Used primarily internally
* @method Phaser.TilemapLayer#_fixY
* @memberof Phaser.TilemapLayer
* @private
* @param {number} y - y coordinate in camera space
* @return {number} y coordinate in scrollFactor-adjusted dimensions
*/
Phaser.TilemapLayer.prototype._fixY = function(y) {
2014-02-05 06:29:17 +00:00
if (y < 0)
{
y = 0;
}
2013-11-28 15:57:09 +00:00
if (this.scrollFactorY === 1)
{
return y;
}
2014-03-24 12:41:45 +00:00
return this._mc.y + (y - (this._mc.y / this.scrollFactorY));
2013-11-28 15:57:09 +00:00
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2014-03-28 01:42:49 +00:00
* Take a y coordinate that _does_ account for scrollFactorY and 'unfix' it
2013-11-28 15:57:09 +00:00
* back to camera space. Used primarily internally
* @method Phaser.TilemapLayer#_unfixY
* @memberof Phaser.TilemapLayer
* @private
* @param {number} y - y coordinate in scrollFactor-adjusted dimensions
* @return {number} y coordinate in camera space
*/
Phaser.TilemapLayer.prototype._unfixY = function(y) {
if (this.scrollFactorY === 1)
{
return y;
}
2014-03-24 12:41:45 +00:00
return (this._mc.y / this.scrollFactorY) + (y - this._mc.y);
2013-11-28 15:57:09 +00:00
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
/**
* Convert a pixel value to a tile coordinate.
* @method Phaser.TilemapLayer#getTileX
* @memberof Phaser.TilemapLayer
* @param {number} x - X position of the point in target tile.
* @return {Phaser.Tile} The tile with specific properties.
*/
Phaser.TilemapLayer.prototype.getTileX = function (x) {
2014-02-05 06:29:17 +00:00
// var tileWidth = this.tileWidth * this.scale.x;
2013-11-28 15:57:09 +00:00
2014-02-05 06:29:17 +00:00
return this.game.math.snapToFloor(this._fixX(x), this.map.tileWidth) / this.map.tileWidth;
2013-11-28 15:57:09 +00:00
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
/**
* Convert a pixel value to a tile coordinate.
* @method Phaser.TilemapLayer#getTileY
* @memberof Phaser.TilemapLayer
* @param {number} y - Y position of the point in target tile.
* @return {Phaser.Tile} The tile with specific properties.
*/
Phaser.TilemapLayer.prototype.getTileY = function (y) {
2014-02-05 06:29:17 +00:00
// var tileHeight = this.tileHeight * this.scale.y;
2013-11-28 15:57:09 +00:00
2014-02-05 06:29:17 +00:00
return this.game.math.snapToFloor(this._fixY(y), this.map.tileHeight) / this.map.tileHeight;
2013-11-28 15:57:09 +00:00
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
/**
* Convert a pixel value to a tile coordinate.
* @method Phaser.TilemapLayer#getTileXY
* @memberof Phaser.TilemapLayer
* @param {number} x - X position of the point in target tile.
* @param {number} y - Y position of the point in target tile.
2014-02-05 06:29:17 +00:00
* @param {Phaser.Point|object} point - The Point object to set the x and y values on.
* @return {Phaser.Point|object} A Point object with its x and y properties set.
2013-11-28 15:57:09 +00:00
*/
Phaser.TilemapLayer.prototype.getTileXY = function (x, y, point) {
point.x = this.getTileX(x);
point.y = this.getTileY(y);
return point;
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
2014-03-14 06:36:05 +00:00
/**
* Gets all tiles that intersect with the given line.
*
* @method Phaser.TilemapLayer#getRayCastTiles
* @memberof Phaser.TilemapLayer
* @param {Phaser.Line} line - The line used to determine which tiles to return.
* @param {number} [stepRate] - How many steps through the ray will we check? If undefined or null it uses TilemapLayer.rayStepRate.
* @param {boolean} [collides=false] - If true only return tiles that collide on one or more faces.
* @param {boolean} [interestingFace=false] - If true only return tiles that have interesting faces.
* @return {array< Phaser.Tile>} An array of Phaser.Tiles.
*/
Phaser.TilemapLayer.prototype.getRayCastTiles = function (line, stepRate, collides, interestingFace) {
if (typeof stepRate === 'undefined' || stepRate === null) { stepRate = this.rayStepRate; }
if (typeof collides === 'undefined') { collides = false; }
if (typeof interestingFace === 'undefined') { interestingFace = false; }
// First get all tiles that touch the bounds of the line
var tiles = this.getTiles(line.x, line.y, line.width, line.height, collides, interestingFace);
if (tiles.length === 0)
{
return [];
}
// Now we only want the tiles that intersect with the points on this line
var coords = line.coordinatesOnLine(stepRate);
var total = coords.length;
var results = [];
for (var i = 0; i < tiles.length; i++)
{
for (var t = 0; t < total; t++)
{
if (tiles[i].containsPoint(coords[t][0], coords[t][1]))
{
results.push(tiles[i]);
break;
}
}
}
return results;
2014-03-28 01:42:49 +00:00
};
2014-03-14 06:36:05 +00:00
2013-11-28 15:57:09 +00:00
/**
2014-02-05 06:29:17 +00:00
* Get all tiles that exist within the given area, defined by the top-left corner, width and height. Values given are in pixels, not tiles.
2013-11-28 15:57:09 +00:00
* @method Phaser.TilemapLayer#getTiles
* @memberof Phaser.TilemapLayer
2014-02-05 06:29:17 +00:00
* @param {number} x - X position of the top left corner.
* @param {number} y - Y position of the top left corner.
* @param {number} width - Width of the area to get.
* @param {number} height - Height of the area to get.
* @param {boolean} [collides=false] - If true only return tiles that collide on one or more faces.
2014-03-14 06:36:05 +00:00
* @param {boolean} [interestingFace=false] - If true only return tiles that have interesting faces.
* @return {array< Phaser.Tile>} An array of Phaser.Tiles.
2013-11-28 15:57:09 +00:00
*/
2014-03-14 06:36:05 +00:00
Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides, interestingFace) {
2013-11-28 15:57:09 +00:00
// Should we only get tiles that have at least one of their collision flags set? (true = yes, false = no just get them all)
if (typeof collides === 'undefined') { collides = false; }
2014-03-14 06:36:05 +00:00
if (typeof interestingFace === 'undefined') { interestingFace = false; }
2013-11-28 15:57:09 +00:00
// adjust the x,y coordinates for scrollFactor
2014-02-05 06:29:17 +00:00
x = this._fixX(x);
y = this._fixY(y);
2013-11-28 15:57:09 +00:00
2014-02-05 06:29:17 +00:00
if (width > this.layer.widthInPixels)
2013-11-28 15:57:09 +00:00
{
2014-02-05 06:29:17 +00:00
width = this.layer.widthInPixels;
2013-11-28 15:57:09 +00:00
}
2014-02-05 06:29:17 +00:00
if (height > this.layer.heightInPixels)
2013-11-28 15:57:09 +00:00
{
2014-02-05 06:29:17 +00:00
height = this.layer.heightInPixels;
2013-11-28 15:57:09 +00:00
}
// Convert the pixel values into tile coordinates
2014-03-24 12:41:45 +00:00
this._mc.tx = this.game.math.snapToFloor(x, this._mc.cw) / this._mc.cw;
this._mc.ty = this.game.math.snapToFloor(y, this._mc.ch) / this._mc.ch;
this._mc.tw = (this.game.math.snapToCeil(width, this._mc.cw) + this._mc.cw) / this._mc.cw;
this._mc.th = (this.game.math.snapToCeil(height, this._mc.ch) + this._mc.ch) / this._mc.ch;
2013-11-28 15:57:09 +00:00
// This should apply the layer x/y here
2014-02-05 06:29:17 +00:00
this._results.length = 0;
2013-11-28 15:57:09 +00:00
2014-03-24 12:41:45 +00:00
for (var wy = this._mc.ty; wy < this._mc.ty + this._mc.th; wy++)
2013-11-28 15:57:09 +00:00
{
2014-03-24 12:41:45 +00:00
for (var wx = this._mc.tx; wx < this._mc.tx + this._mc.tw; wx++)
2013-11-28 15:57:09 +00:00
{
2014-04-11 12:09:28 +00:00
if (this.layer.data[wy] & & this.layer.data[wy][wx])
2013-11-28 15:57:09 +00:00
{
2014-04-11 12:09:28 +00:00
if ((!collides & & !interestingFace) || this.layer.data[wy][wx].isInteresting(collides, interestingFace))
2013-11-28 15:57:09 +00:00
{
2014-03-14 06:36:05 +00:00
this._results.push(this.layer.data[wy][wx]);
2013-11-28 15:57:09 +00:00
}
}
}
}
return this._results;
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
/**
* Internal function to update maximum values.
* @method Phaser.TilemapLayer#updateMax
* @memberof Phaser.TilemapLayer
*/
Phaser.TilemapLayer.prototype.updateMax = function () {
2014-03-24 12:41:45 +00:00
this._mc.maxX = this.game.math.ceil(this.canvas.width / this.map.tileWidth) + 1;
this._mc.maxY = this.game.math.ceil(this.canvas.height / this.map.tileHeight) + 1;
2013-11-28 15:57:09 +00:00
this.dirty = true;
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
/**
* Renders the tiles to the layer canvas and pushes to the display.
* @method Phaser.TilemapLayer#render
* @memberof Phaser.TilemapLayer
*/
Phaser.TilemapLayer.prototype.render = function () {
2014-03-14 06:36:05 +00:00
if (this.layer.dirty)
2013-11-28 15:57:09 +00:00
{
this.dirty = true;
}
2014-02-05 06:29:17 +00:00
if (!this.dirty || !this.visible)
2013-11-28 15:57:09 +00:00
{
return;
}
2014-03-24 12:41:45 +00:00
this._mc.prevX = this._mc.dx;
this._mc.prevY = this._mc.dy;
2013-11-28 15:57:09 +00:00
2014-03-24 12:41:45 +00:00
this._mc.dx = -(this._mc.x - (this._mc.startX * this.map.tileWidth));
this._mc.dy = -(this._mc.y - (this._mc.startY * this.map.tileHeight));
2013-11-28 15:57:09 +00:00
2014-03-24 12:41:45 +00:00
this._mc.tx = this._mc.dx;
this._mc.ty = this._mc.dy;
2013-11-28 15:57:09 +00:00
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
2014-02-05 06:29:17 +00:00
this.context.fillStyle = this.tileColor;
var tile;
var set;
if (this.debug)
{
this.context.globalAlpha = this.debugAlpha;
}
2014-03-24 12:41:45 +00:00
for (var y = this._mc.startY, lenY = this._mc.startY + this._mc.maxY; y < lenY; y++)
2013-11-28 15:57:09 +00:00
{
2014-07-10 19:31:11 +00:00
this._column = null;
if (y < 0 & & this.wrap)
{
this._column = this.layer.data[y + this.map.height];
}
else if (y >= this.map.height & & this.wrap)
{
this._column = this.layer.data[y - this.map.height];
}
else if (this.layer.data[y])
{
this._column = this.layer.data[y];
}
2013-11-28 15:57:09 +00:00
2014-07-10 19:31:11 +00:00
if (this._column)
2013-11-28 15:57:09 +00:00
{
2014-07-10 19:31:11 +00:00
for (var x = this._mc.startX, lenX = this._mc.startX + this._mc.maxX; x < lenX; x++)
2013-11-28 15:57:09 +00:00
{
2014-07-10 19:31:11 +00:00
var tile = null;
2014-02-05 06:29:17 +00:00
2014-07-10 19:31:11 +00:00
if (x < 0 & & this.wrap)
{
tile = this._column[x + this.map.width];
}
else if (x >= this.map.width & & this.wrap)
{
tile = this._column[x - this.map.width];
}
else if (this._column[x])
{
tile = this._column[x];
}
if (tile & & tile.index > -1)
2014-02-05 06:29:17 +00:00
{
2014-04-29 14:39:02 +00:00
set = this.map.tilesets[this.map.tiles[tile.index][2]];
2014-03-14 06:36:05 +00:00
2014-04-29 14:39:02 +00:00
if (this.debug === false & & tile.alpha !== this.context.globalAlpha)
{
this.context.globalAlpha = tile.alpha;
}
2014-03-14 06:36:05 +00:00
2014-04-29 14:39:02 +00:00
set.draw(this.context, Math.floor(this._mc.tx), Math.floor(this._mc.ty), tile.index);
if (tile.debug)
{
this.context.fillStyle = 'rgba(0, 255, 0, 0.4)';
this.context.fillRect(Math.floor(this._mc.tx), Math.floor(this._mc.ty), this.map.tileWidth, this.map.tileHeight);
}
2014-02-05 06:29:17 +00:00
}
2013-11-28 15:57:09 +00:00
2014-07-10 19:31:11 +00:00
this._mc.tx += this.map.tileWidth;
}
2013-11-28 15:57:09 +00:00
}
2014-03-24 12:41:45 +00:00
this._mc.tx = this._mc.dx;
this._mc.ty += this.map.tileHeight;
2014-02-05 06:29:17 +00:00
}
if (this.debug)
{
this.context.globalAlpha = 1;
this.renderDebug();
2013-11-28 15:57:09 +00:00
}
2014-10-22 20:49:44 +00:00
this.texture._updateUvs();
2013-11-28 15:57:09 +00:00
this.dirty = false;
2014-02-05 06:29:17 +00:00
this.layer.dirty = false;
2013-11-28 15:57:09 +00:00
return true;
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2014-02-05 06:29:17 +00:00
* Renders a collision debug overlay on-top of the canvas. Called automatically by render when debug = true.
* @method Phaser.TilemapLayer#renderDebug
2013-11-28 15:57:09 +00:00
* @memberof Phaser.TilemapLayer
*/
2014-02-05 06:29:17 +00:00
Phaser.TilemapLayer.prototype.renderDebug = function () {
2013-11-28 15:57:09 +00:00
2014-03-24 12:41:45 +00:00
this._mc.tx = this._mc.dx;
this._mc.ty = this._mc.dy;
2013-11-28 15:57:09 +00:00
2014-02-05 06:29:17 +00:00
this.context.strokeStyle = this.debugColor;
this.context.fillStyle = this.debugFillColor;
2014-03-24 12:41:45 +00:00
for (var y = this._mc.startY, lenY = this._mc.startY + this._mc.maxY; y < lenY; y++)
2014-02-05 06:29:17 +00:00
{
2014-07-10 19:31:11 +00:00
this._column = null;
2014-02-05 06:29:17 +00:00
2014-07-10 19:31:11 +00:00
if (y < 0 & & this.wrap)
{
this._column = this.layer.data[y + this.map.height];
}
else if (y >= this.map.height & & this.wrap)
2014-02-05 06:29:17 +00:00
{
2014-07-10 19:31:11 +00:00
this._column = this.layer.data[y - this.map.height];
}
else if (this.layer.data[y])
{
this._column = this.layer.data[y];
}
2014-02-05 06:29:17 +00:00
2014-07-10 19:31:11 +00:00
if (this._column)
{
for (var x = this._mc.startX, lenX = this._mc.startX + this._mc.maxX; x < lenX; x++)
2014-02-05 06:29:17 +00:00
{
2014-07-10 19:31:11 +00:00
var tile = null;
2014-02-05 06:29:17 +00:00
2014-07-10 19:31:11 +00:00
if (x < 0 & & this.wrap)
2014-02-05 06:29:17 +00:00
{
2014-07-10 19:31:11 +00:00
tile = this._column[x + this.map.width];
2014-02-05 06:29:17 +00:00
}
2014-07-10 19:31:11 +00:00
else if (x >= this.map.width & & this.wrap)
2014-02-05 06:29:17 +00:00
{
2014-07-10 19:31:11 +00:00
tile = this._column[x - this.map.width];
2014-02-05 06:29:17 +00:00
}
2014-07-10 19:31:11 +00:00
else if (this._column[x])
2014-02-05 06:29:17 +00:00
{
2014-07-10 19:31:11 +00:00
tile = this._column[x];
2014-02-05 06:29:17 +00:00
}
2014-07-10 19:31:11 +00:00
if (tile & & (tile.faceTop || tile.faceBottom || tile.faceLeft || tile.faceRight))
2014-02-05 06:29:17 +00:00
{
2014-07-10 19:31:11 +00:00
this._mc.tx = Math.floor(this._mc.tx);
2014-02-05 06:29:17 +00:00
2014-07-10 19:31:11 +00:00
if (this.debugFill)
{
this.context.fillRect(this._mc.tx, this._mc.ty, this._mc.cw, this._mc.ch);
}
2014-02-05 06:29:17 +00:00
2014-07-10 19:31:11 +00:00
this.context.beginPath();
if (tile.faceTop)
{
this.context.moveTo(this._mc.tx, this._mc.ty);
this.context.lineTo(this._mc.tx + this._mc.cw, this._mc.ty);
}
if (tile.faceBottom)
{
this.context.moveTo(this._mc.tx, this._mc.ty + this._mc.ch);
this.context.lineTo(this._mc.tx + this._mc.cw, this._mc.ty + this._mc.ch);
}
if (tile.faceLeft)
{
this.context.moveTo(this._mc.tx, this._mc.ty);
this.context.lineTo(this._mc.tx, this._mc.ty + this._mc.ch);
}
if (tile.faceRight)
{
this.context.moveTo(this._mc.tx + this._mc.cw, this._mc.ty);
this.context.lineTo(this._mc.tx + this._mc.cw, this._mc.ty + this._mc.ch);
}
2014-02-05 06:29:17 +00:00
2014-07-10 19:31:11 +00:00
this.context.stroke();
}
this._mc.tx += this.map.tileWidth;
2014-02-05 06:29:17 +00:00
2014-07-10 19:31:11 +00:00
}
2014-02-05 06:29:17 +00:00
}
2014-03-24 12:41:45 +00:00
this._mc.tx = this._mc.dx;
this._mc.ty += this.map.tileHeight;
2014-02-05 06:29:17 +00:00
}
2013-11-28 15:57:09 +00:00
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
/**
* @name Phaser.TilemapLayer#scrollX
* @property {number} scrollX - Scrolls the map horizontally or returns the current x position.
*/
Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollX", {
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
get: function () {
2014-03-24 12:41:45 +00:00
return this._mc.x;
2013-11-28 15:57:09 +00:00
},
set: function (value) {
2014-07-10 19:31:11 +00:00
if (value !== this._mc.x)
2013-11-28 15:57:09 +00:00
{
2014-03-24 12:41:45 +00:00
this._mc.x = value;
this._mc.startX = this.game.math.floor(this._mc.x / this.map.tileWidth);
2013-11-28 15:57:09 +00:00
this.dirty = true;
}
}
});
/**
* @name Phaser.TilemapLayer#scrollY
* @property {number} scrollY - Scrolls the map vertically or returns the current y position.
*/
Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollY", {
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
get: function () {
2014-03-24 12:41:45 +00:00
return this._mc.y;
2013-11-28 15:57:09 +00:00
},
set: function (value) {
2014-07-10 19:31:11 +00:00
if (value !== this._mc.y)
2013-11-28 15:57:09 +00:00
{
2014-03-24 12:41:45 +00:00
this._mc.y = value;
this._mc.startY = this.game.math.floor(this._mc.y / this.map.tileHeight);
2013-11-28 15:57:09 +00:00
this.dirty = true;
}
}
2014-02-05 06:29:17 +00:00
});
/**
* @name Phaser.TilemapLayer#collisionWidth
* @property {number} collisionWidth - The width of the collision tiles.
*/
Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionWidth", {
2014-03-28 01:42:49 +00:00
2014-02-05 06:29:17 +00:00
get: function () {
2014-03-24 12:41:45 +00:00
return this._mc.cw;
2014-02-05 06:29:17 +00:00
},
set: function (value) {
2014-03-24 12:41:45 +00:00
this._mc.cw = value;
2014-02-05 06:29:17 +00:00
this.dirty = true;
}
});
/**
* @name Phaser.TilemapLayer#collisionHeight
* @property {number} collisionHeight - The height of the collision tiles.
*/
Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionHeight", {
2014-03-28 01:42:49 +00:00
2014-02-05 06:29:17 +00:00
get: function () {
2014-03-24 12:41:45 +00:00
return this._mc.ch;
2014-02-05 06:29:17 +00:00
},
set: function (value) {
2014-03-24 12:41:45 +00:00
this._mc.ch = value;
2014-02-05 06:29:17 +00:00
this.dirty = true;
}
2013-11-28 15:57:09 +00:00
});
< / pre >
< / article >
< / section >
< / div >
< div class = "clearfix" > < / div >
< footer >
< span class = "copyright" >
2014-02-05 06:29:17 +00:00
Phaser Copyright © 2012-2014 Photon Storm Ltd.
2013-11-28 15:57:09 +00:00
< / span >
< br / >
< span class = "jsdoc-message" >
2014-04-11 12:09:28 +00:00
Documentation generated by < a href = "https://github.com/jsdoc3/jsdoc" > JSDoc 3.3.0-dev< / a >
2014-10-22 20:49:44 +00:00
on Wed Oct 22 2014 21:45:44 GMT+0100 (BST) using the < a href = "https://github.com/terryweiss/docstrap" > DocStrap template< / a > .
2013-11-28 15:57:09 +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-11-28 15:57:09 +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 >