phaser/docs/src_tilemap_TilemapLayer.js.html

2460 lines
69 KiB
HTML
Raw Normal View History

2013-11-28 15:57:09 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
2015-03-23 23:46:30 +00:00
<title>Phaser Source: src/tilemap/TilemapLayer.js</title>
2013-11-28 15:57:09 +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-11-28 15:57:09 +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-11-28 15:57:09 +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-11-28 15:57:09 +00:00
<div class="navbar-inner">
2014-11-25 00:23:44 +00:00
<a class="brand" href="index.html">Phaser API</a>
2013-11-28 15:57:09 +00:00
<ul class="nav">
2014-11-25 00:23:44 +00:00
2013-11-28 15:57:09 +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-11-28 15:57:09 +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-11-28 15:57:09 +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-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-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-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>
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-11-28 15:57:09 +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-11-28 15:57:09 +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">
<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">
<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">
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">
<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-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>
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-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">
<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">
<a href="Phaser.Physics.Ninja.html">Ninja</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.AABB.html">AABB</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Body.html">Body</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Circle.html">Circle</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Tile.html">Tile</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Physics.P2.html">P2</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Body.html">Body</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.BodyDebug.html">BodyDebug</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.DistanceConstraint.html">DistanceConstraint</a>
</li>
<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">
<a href="Phaser.Physics.P2.GearConstraint.html">GearConstraint</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.InversePointProxy.html">InversePointProxy</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.LockConstraint.html">LockConstraint</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Material.html">Material</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PointProxy.html">PointProxy</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PrismaticConstraint.html">PrismaticConstraint</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<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">
<a href="Phaser.Physics.P2.Spring.html">Spring</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.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>
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-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">
<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">
<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">
<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>
<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">
<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-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-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">
2015-07-22 14:31:30 +00:00
<a href="Phaser.Video.html">Video</a>
2013-11-28 15:57:09 +00:00
</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.DisplayObject.html">DisplayObject</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>
<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 ">
<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>
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>
<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>
<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>
<li class="class-depth-0">
<a href="global.html#IMAGE">IMAGE</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT">LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#LINE">LINE</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#MATRIX">MATRIX</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#NONE">NONE</a>
2014-11-15 20:01:46 +00:00
</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-03-23 23:46:30 +00:00
<li class="class-depth-0">
2015-07-22 14:31:30 +00:00
<a href="global.html#POINT">POINT</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#POINTER">POINTER</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#POLYGON">POLYGON</a>
</li>
<li class="class-depth-0">
<a href="global.html#RECTANGLE">RECTANGLE</a>
</li>
<li class="class-depth-0">
<a href="global.html#RENDERTEXTURE">RENDERTEXTURE</a>
</li>
<li class="class-depth-0">
<a href="global.html#RETROFONT">RETROFONT</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT">RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#ROPE">ROPE</a>
</li>
<li class="class-depth-0">
<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>
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#TEXT">TEXT</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#TILEMAP">TILEMAP</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILEMAPLAYER">TILEMAPLAYER</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILESPRITE">TILESPRITE</a>
</li>
<li class="class-depth-0">
<a href="global.html#UP">UP</a>
</li>
<li class="class-depth-0">
<a href="global.html#VERSION">VERSION</a>
</li>
<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-11-28 15:57:09 +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>
<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-05-19 11:36:51 +00:00
<li class="class-depth-1"><a href="http://phaser.io/news/2015/08/phaser-slack-channel">Slack</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>
2014-11-15 20:01:46 +00:00
</ul>
</div>
</div>
<div class="row-fluid">
2013-11-28 15:57:09 +00:00
<div class="span12">
<div id="main">
2015-03-23 23:46:30 +00:00
<h1 class="page-title">Source: src/tilemap/TilemapLayer.js</h1>
2013-11-28 15:57:09 +00:00
<section>
<article>
<pre class="sunlight-highlight-javascript linenums">/**
* @author Richard Davey &lt;rich@photonstorm.com>
2016-04-22 14:15:28 +00:00
* @copyright 2016 Photon Storm Ltd.
2013-11-28 15:57:09 +00:00
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
2014-11-15 20:01:46 +00:00
* A TilemapLayer is a Phaser.Image/Sprite that renders a specific TileLayer of a Tilemap.
*
* Since a TilemapLayer is a Sprite it can be moved around the display, added to other groups or display objects, etc.
2015-01-06 06:57:25 +00:00
*
2015-03-23 23:46:30 +00:00
* By default TilemapLayers have fixedToCamera set to `true`. Changing this will break Camera follow and scrolling behavior.
2013-11-28 15:57:09 +00:00
*
* @class Phaser.TilemapLayer
2015-07-22 14:31:30 +00:00
* @extends Phaser.Sprite
2013-11-28 15:57:09 +00:00
* @constructor
* @param {Phaser.Game} game - Game reference to the currently running game.
* @param {Phaser.Tilemap} tilemap - The tilemap to which this layer belongs.
2014-11-15 20:01:46 +00:00
* @param {integer} index - The index of the TileLayer to render within the Tilemap.
* @param {integer} width - Width of the renderable area of the layer (in pixels).
* @param {integer} height - Height of the renderable area of the layer (in pixels).
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
2014-11-15 20:01:46 +00:00
width |= 0;
height |= 0;
2015-07-22 14:31:30 +00:00
Phaser.Sprite.call(this, game, 0, 0);
2014-02-05 06:29:17 +00:00
/**
2014-11-15 20:01:46 +00:00
* The Tilemap to which this layer is bound.
* @property {Phaser.Tilemap} map
* @protected
* @readonly
2014-02-05 06:29:17 +00:00
*/
this.map = tilemap;
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* The index of this layer within the Tilemap.
* @property {number} index
* @protected
* @readonly
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
this.index = index;
/**
2014-11-15 20:01:46 +00:00
* The layer object within the Tilemap that this layer represents.
2015-07-22 14:31:30 +00:00
* @property {object} layer
2014-11-15 20:01:46 +00:00
* @protected
* @readonly
2014-02-05 06:29:17 +00:00
*/
this.layer = tilemap.layers[index];
/**
2014-11-15 20:01:46 +00:00
* The canvas to which this TilemapLayer draws.
* @property {HTMLCanvasElement} canvas
* @protected
2014-02-05 06:29:17 +00:00
*/
2015-08-24 14:43:45 +00:00
this.canvas = PIXI.CanvasPool.create(this, width, height);
2014-03-24 12:41:45 +00:00
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* The 2d context of the canvas.
* @property {CanvasRenderingContext2D} context
* @private
2013-11-28 15:57:09 +00:00
*/
this.context = this.canvas.getContext('2d');
2015-07-22 14:31:30 +00:00
this.setTexture(new PIXI.Texture(new PIXI.BaseTexture(this.canvas)));
2014-02-05 06:29:17 +00:00
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* The const type of this object.
* @property {number} type
* @readonly
* @protected
* @default Phaser.TILEMAPLAYER
2013-11-28 15:57:09 +00:00
*/
this.type = Phaser.TILEMAPLAYER;
/**
2015-03-23 23:46:30 +00:00
* @property {number} physicsType - The const physics body type of this object.
* @readonly
2013-11-28 15:57:09 +00:00
*/
2015-03-23 23:46:30 +00:00
this.physicsType = Phaser.TILEMAPLAYER;
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* Settings that control standard (non-diagnostic) rendering.
*
2015-07-22 14:31:30 +00:00
* @property {boolean} [enableScrollDelta=true] - Delta scroll rendering only draws tiles/edges as they come into view.
2015-01-06 06:57:25 +00:00
* This can greatly improve scrolling rendering performance, especially when there are many small tiles.
* It should only be disabled in rare cases.
*
* @property {?DOMCanvasElement} [copyCanvas=(auto)] - [Internal] If set, force using a separate (shared) copy canvas.
* Using a canvas bitblt/copy when the source and destinations region overlap produces unexpected behavior
* in some browsers, notably Safari.
*
2014-02-05 06:29:17 +00:00
* @default
2013-11-28 15:57:09 +00:00
*/
2014-11-15 20:01:46 +00:00
this.renderSettings = {
2015-07-22 14:31:30 +00:00
enableScrollDelta: false,
2015-01-06 06:57:25 +00:00
overdrawRatio: 0.20,
2015-03-23 23:46:30 +00:00
copyCanvas: null
2014-11-15 20:01:46 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* Enable an additional "debug rendering" pass to display collision information.
*
* @property {boolean} debug
2014-02-05 06:29:17 +00:00
* @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
2015-03-23 23:46:30 +00:00
/**
* @property {boolean} exists - Controls if the core game loop and physics update this game object or not.
*/
this.exists = true;
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* Settings used for debugging and diagnostics.
*
* @property {?string} missingImageFill - A tile is rendered as a rectangle using the following fill if a valid tileset/image cannot be found. A value of `null` prevents additional rendering for tiles without a valid tileset image. _This takes effect even when debug rendering for the layer is not enabled._
*
* @property {?string} debuggedTileOverfill - If a Tile has `Tile#debug` true then, after normal tile image rendering, a rectangle with the following fill is drawn above/over it. _This takes effect even when debug rendering for the layer is not enabled._
*
* @property {boolean} forceFullRedraw - When debug rendering (`debug` is true), and this option is enabled, the a full redraw is forced and rendering optimization is suppressed.
*
* @property {number} debugAlpha - When debug rendering (`debug` is true), the tileset is initially rendered with this alpha level. This can make the tile edges clearer.
*
* @property {?string} facingEdgeStroke - When debug rendering (`debug` is true), this color/stroke is used to draw "face" edges. A value of `null` disables coloring facing edges.
*
* @property {?string} collidingTileOverfill - When debug rendering (`debug` is true), this fill is used for tiles that are collidable. A value of `null` disables applying the additional overfill.
*
2013-11-28 15:57:09 +00:00
*/
2014-11-15 20:01:46 +00:00
this.debugSettings = {
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
missingImageFill: 'rgb(255,255,255)',
debuggedTileOverfill: 'rgba(0,255,0,0.4)',
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
forceFullRedraw: true,
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
debugAlpha: 0.5,
facingEdgeStroke: 'rgba(0,255,0,1)',
collidingTileOverfill: 'rgba(0,255,0,0.2)'
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* 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).
* @property {number} scrollFactorX
* @public
* @default
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
this.scrollFactorX = 1;
/**
2014-11-15 20:01:46 +00:00
* 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)
* @property {number} scrollFactorY
* @public
* @default
2014-02-05 06:29:17 +00:00
*/
this.scrollFactorY = 1;
/**
2014-11-15 20:01:46 +00:00
* If true tiles will be force rendered, even if such is not believed to be required.
* @property {boolean} dirty
* @protected
2014-02-05 06:29:17 +00:00
*/
this.dirty = true;
/**
2014-11-15 20:01:46 +00:00
* 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.
* @property {integer} rayStepRate
* @default
*/
this.rayStepRate = 4;
2014-07-10 19:31:11 +00:00
/**
2014-11-15 20:01:46 +00:00
* Flag controlling if the layer tiles wrap at the edges.
* @property {boolean} _wrap
* @private
2014-07-10 19:31:11 +00:00
*/
2014-11-15 20:01:46 +00:00
this._wrap = false;
2014-07-10 19:31:11 +00:00
2014-02-05 06:29:17 +00:00
/**
2014-11-15 20:01:46 +00:00
* Local map data and calculation cache.
* @property {object} _mc
* @private
2013-11-28 15:57:09 +00:00
*/
2014-03-24 12:41:45 +00:00
this._mc = {
2014-11-15 20:01:46 +00:00
// Used to bypass rendering without reliance on `dirty` and detect changes.
scrollX: 0,
scrollY: 0,
renderWidth: 0,
renderHeight: 0,
tileWidth: tilemap.tileWidth,
tileHeight: tilemap.tileHeight,
// Collision width/height (pixels)
// What purpose do these have? Most things use tile width/height directly.
// This also only extends collisions right and down.
2014-03-24 12:41:45 +00:00
cw: tilemap.tileWidth,
ch: tilemap.tileHeight,
2014-11-15 20:01:46 +00:00
// Cached tilesets from index -> Tileset
tilesets: []
2014-03-24 12:41:45 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* The current canvas left after scroll is applied.
* @property {number} _scrollX
* @private
2013-11-28 15:57:09 +00:00
*/
2014-11-15 20:01:46 +00:00
this._scrollX = 0;
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
/**
* The current canvas top after scroll is applied.
* @propety {number} _scrollY
* @private
*/
this._scrollY = 0;
/**
* Used for caching the tiles / array of tiles.
* @property {Phaser.Tile[]} _results
* @private
*/
this._results = [];
2013-11-28 15:57:09 +00:00
2015-01-06 06:57:25 +00:00
if (!game.device.canvasBitBltShift)
{
this.renderSettings.copyCanvas = Phaser.TilemapLayer.ensureSharedCopyCanvas();
}
2015-03-23 23:46:30 +00:00
this.fixedToCamera = true;
2015-01-06 06:57:25 +00:00
};
2015-07-22 14:31:30 +00:00
Phaser.TilemapLayer.prototype = Object.create(Phaser.Sprite.prototype);
2015-03-23 23:46:30 +00:00
Phaser.TilemapLayer.prototype.constructor = Phaser.TilemapLayer;
2015-07-22 14:31:30 +00:00
Phaser.TilemapLayer.prototype.preUpdateCore = Phaser.Component.Core.preUpdate;
2015-03-23 23:46:30 +00:00
2015-01-06 06:57:25 +00:00
/**
* The shared double-copy canvas, created as needed.
*
* @private
* @static
*/
Phaser.TilemapLayer.sharedCopyCanvas = null;
/**
* Create if needed (and return) a shared copy canvas that is shared across all TilemapLayers.
*
* Code that uses the canvas is responsible to ensure the dimensions and save/restore state as appropriate.
*
2015-08-24 14:43:45 +00:00
* @method Phaser.TilemapLayer#ensureSharedCopyCanvas
2015-01-06 06:57:25 +00:00
* @protected
* @static
*/
Phaser.TilemapLayer.ensureSharedCopyCanvas = function () {
2015-03-23 23:46:30 +00:00
2015-01-06 06:57:25 +00:00
if (!this.sharedCopyCanvas)
{
this.sharedCopyCanvas = Phaser.Canvas.create(2, 2);
}
2015-03-23 23:46:30 +00:00
2015-01-06 06:57:25 +00:00
return this.sharedCopyCanvas;
2013-11-28 15:57:09 +00:00
2015-03-23 23:46:30 +00:00
};
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
/**
2015-03-23 23:46:30 +00:00
* Automatically called by World.preUpdate.
2014-11-15 20:01:46 +00:00
*
2015-08-24 14:43:45 +00:00
* @method Phaser.TilemapLayer#preUpdate
2014-11-15 20:01:46 +00:00
*/
2015-03-23 23:46:30 +00:00
Phaser.TilemapLayer.prototype.preUpdate = function() {
2014-11-15 20:01:46 +00:00
2015-07-22 14:31:30 +00:00
return this.preUpdateCore();
2015-03-23 23:46:30 +00:00
};
2014-11-15 20:01:46 +00:00
2013-11-28 15:57:09 +00:00
/**
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
2014-11-15 20:01:46 +00:00
* @protected
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
Phaser.TilemapLayer.prototype.postUpdate = function () {
2013-11-28 15:57:09 +00:00
2015-07-22 14:31:30 +00:00
Phaser.Component.FixedToCamera.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
2014-11-15 20:01:46 +00:00
var camera = this.game.camera;
2013-11-28 15:57:09 +00:00
2015-03-23 23:46:30 +00:00
this.scrollX = camera.x * this.scrollFactorX / this.scale.x;
this.scrollY = camera.y * this.scrollFactorY / this.scale.y;
2014-03-24 12:41:45 +00:00
2015-03-23 23:46:30 +00:00
this.render();
2014-03-24 12:41:45 +00:00
};
2013-11-28 15:57:09 +00:00
2015-08-24 14:43:45 +00:00
/**
* Destroys this TilemapLayer.
*
* @method Phaser.TilemapLayer#destroy
*/
Phaser.TilemapLayer.prototype.destroy = function() {
PIXI.CanvasPool.remove(this);
Phaser.Component.Destroy.prototype.destroy.call(this);
};
2015-07-22 14:31:30 +00:00
/**
* Resizes the internal canvas and texture frame used by this TilemapLayer.
*
* This is an expensive call, so don't bind it to a window resize event! But instead call it at carefully
* selected times.
*
* Be aware that no validation of the new sizes takes place and the current map scroll coordinates are not
* modified either. You will have to handle both of these things from your game code if required.
*
* @method Phaser.TilemapLayer#resize
* @param {number} width - The new width of the TilemapLayer
* @param {number} height - The new height of the TilemapLayer
*/
Phaser.TilemapLayer.prototype.resize = function (width, height) {
this.canvas.width = width;
this.canvas.height = height;
this.texture.frame.resize(width, height);
this.texture.width = width;
this.texture.height = height;
this.texture.crop.width = width;
this.texture.crop.height = height;
this.texture.baseTexture.width = width;
this.texture.baseTexture.height = height;
this.texture.baseTexture.dirty();
this.texture.requiresUpdate = true;
this.texture._updateUvs();
this.dirty = true;
};
2013-11-28 15:57:09 +00:00
/**
* Sets the world size to match the size of this layer.
*
* @method Phaser.TilemapLayer#resizeWorld
2014-11-15 20:01:46 +00:00
* @public
2013-11-28 15:57:09 +00:00
*/
Phaser.TilemapLayer.prototype.resizeWorld = function () {
2015-03-23 23:46:30 +00:00
this.game.world.setBounds(0, 0, this.layer.widthInPixels * this.scale.x, this.layer.heightInPixels * this.scale.y);
2013-11-28 15:57:09 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* Take an x coordinate that doesn't account for scrollFactorX and 'fix' it into a scrolled local space.
*
2013-11-28 15:57:09 +00:00
* @method Phaser.TilemapLayer#_fixX
* @private
* @param {number} x - x coordinate in camera space
* @return {number} x coordinate in scrollFactor-adjusted dimensions
*/
2014-11-15 20:01:46 +00:00
Phaser.TilemapLayer.prototype._fixX = function (x) {
2013-11-28 15:57:09 +00:00
2014-02-05 06:29:17 +00:00
if (x &lt; 0)
{
x = 0;
}
2013-11-28 15:57:09 +00:00
if (this.scrollFactorX === 1)
{
return x;
}
2014-11-15 20:01:46 +00:00
return this._scrollX + (x - (this._scrollX / this.scrollFactorX));
2013-11-28 15:57:09 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* Take an x coordinate that _does_ account for scrollFactorX and 'unfix' it back to camera space.
*
2013-11-28 15:57:09 +00:00
* @method Phaser.TilemapLayer#_unfixX
* @private
* @param {number} x - x coordinate in scrollFactor-adjusted dimensions
* @return {number} x coordinate in camera space
*/
2014-11-15 20:01:46 +00:00
Phaser.TilemapLayer.prototype._unfixX = function (x) {
2013-11-28 15:57:09 +00:00
if (this.scrollFactorX === 1)
{
return x;
}
2014-11-15 20:01:46 +00:00
return (this._scrollX / this.scrollFactorX) + (x - this._scrollX);
2013-11-28 15:57:09 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* Take a y coordinate that doesn't account for scrollFactorY and 'fix' it into a scrolled local space.
*
2013-11-28 15:57:09 +00:00
* @method Phaser.TilemapLayer#_fixY
* @private
* @param {number} y - y coordinate in camera space
* @return {number} y coordinate in scrollFactor-adjusted dimensions
*/
2014-11-15 20:01:46 +00:00
Phaser.TilemapLayer.prototype._fixY = function (y) {
2013-11-28 15:57:09 +00:00
2014-02-05 06:29:17 +00:00
if (y &lt; 0)
{
y = 0;
}
2013-11-28 15:57:09 +00:00
if (this.scrollFactorY === 1)
{
return y;
}
2014-11-15 20:01:46 +00:00
return this._scrollY + (y - (this._scrollY / this.scrollFactorY));
2013-11-28 15:57:09 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* Take a y coordinate that _does_ account for scrollFactorY and 'unfix' it back to camera space.
*
2013-11-28 15:57:09 +00:00
* @method Phaser.TilemapLayer#_unfixY
* @private
* @param {number} y - y coordinate in scrollFactor-adjusted dimensions
* @return {number} y coordinate in camera space
*/
2014-11-15 20:01:46 +00:00
Phaser.TilemapLayer.prototype._unfixY = function (y) {
2013-11-28 15:57:09 +00:00
if (this.scrollFactorY === 1)
{
return y;
}
2014-11-15 20:01:46 +00:00
return (this._scrollY / this.scrollFactorY) + (y - this._scrollY);
2013-11-28 15:57:09 +00:00
};
2013-11-28 15:57:09 +00:00
/**
* Convert a pixel value to a tile coordinate.
2014-11-15 20:01:46 +00:00
*
2013-11-28 15:57:09 +00:00
* @method Phaser.TilemapLayer#getTileX
2014-11-15 20:01:46 +00:00
* @public
* @param {number} x - X position of the point in target tile (in pixels).
* @return {integer} The X map location of the tile.
2013-11-28 15:57:09 +00:00
*/
Phaser.TilemapLayer.prototype.getTileX = function (x) {
2014-02-05 06:29:17 +00:00
// var tileWidth = this.tileWidth * this.scale.x;
2014-11-15 20:01:46 +00:00
return Math.floor(this._fixX(x) / this._mc.tileWidth);
2013-11-28 15:57:09 +00:00
};
2013-11-28 15:57:09 +00:00
/**
* Convert a pixel value to a tile coordinate.
2014-11-15 20:01:46 +00:00
*
2013-11-28 15:57:09 +00:00
* @method Phaser.TilemapLayer#getTileY
2014-11-15 20:01:46 +00:00
* @public
* @param {number} y - Y position of the point in target tile (in pixels).
* @return {integer} The Y map location of the tile.
2013-11-28 15:57:09 +00:00
*/
Phaser.TilemapLayer.prototype.getTileY = function (y) {
2014-02-05 06:29:17 +00:00
// var tileHeight = this.tileHeight * this.scale.y;
2014-11-15 20:01:46 +00:00
return Math.floor(this._fixY(y) / this._mc.tileHeight);
2013-11-28 15:57:09 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* Convert a pixel coordinate to a tile coordinate.
*
2013-11-28 15:57:09 +00:00
* @method Phaser.TilemapLayer#getTileXY
2014-11-15 20:01:46 +00:00
* @public
* @param {number} x - X position of the point in target tile (in pixels).
* @param {number} y - Y position of the point in target tile (in pixels).
* @param {(Phaser.Point|object)} point - The Point/object to update.
* @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;
};
2013-11-28 15:57:09 +00:00
/**
* Gets all tiles that intersect with the given line.
*
* @method Phaser.TilemapLayer#getRayCastTiles
2014-11-15 20:01:46 +00:00
* @public
* @param {Phaser.Line} line - The line used to determine which tiles to return.
2014-11-15 20:01:46 +00:00
* @param {integer} [stepRate=(rayStepRate)] - How many steps through the ray will we check? Defaults to `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 {Phaser.Tile[]} An array of Phaser.Tiles.
*/
Phaser.TilemapLayer.prototype.getRayCastTiles = function (line, stepRate, collides, interestingFace) {
2014-11-15 20:01:46 +00:00
if (!stepRate) { stepRate = this.rayStepRate; }
2015-07-22 14:31:30 +00:00
if (collides === undefined) { collides = false; }
if (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 results = [];
for (var i = 0; i &lt; tiles.length; i++)
{
2014-11-15 20:01:46 +00:00
for (var t = 0; t &lt; coords.length; t++)
{
2014-11-15 20:01:46 +00:00
var tile = tiles[i];
var coord = coords[t];
if (tile.containsPoint(coord[0], coord[1]))
{
2014-11-15 20:01:46 +00:00
results.push(tile);
break;
}
}
}
return results;
};
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.
2014-11-15 20:01:46 +00:00
*
2013-11-28 15:57:09 +00:00
* @method Phaser.TilemapLayer#getTiles
2014-11-15 20:01:46 +00:00
* @public
* @param {number} x - X position of the top left corner (in pixels).
* @param {number} y - Y position of the top left corner (in pixels).
* @param {number} width - Width of the area to get (in pixels).
* @param {number} height - Height of the area to get (in pixels).
* @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&lt;Phaser.Tile>} An array of Tiles.
2013-11-28 15:57:09 +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)
2015-07-22 14:31:30 +00:00
if (collides === undefined) { collides = false; }
if (interestingFace === undefined) { interestingFace = false; }
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
var fetchAll = !(collides || interestingFace);
// 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
// Convert the pixel values into tile coordinates
2015-03-23 23:46:30 +00:00
var tx = Math.floor(x / (this._mc.cw * this.scale.x));
var ty = Math.floor(y / (this._mc.ch * this.scale.y));
2014-11-15 20:01:46 +00:00
// Don't just use ceil(width/cw) to allow account for x/y diff within cell
2015-03-23 23:46:30 +00:00
var tw = Math.ceil((x + width) / (this._mc.cw * this.scale.x)) - tx;
var th = Math.ceil((y + height) / (this._mc.ch * this.scale.y)) - ty;
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
while (this._results.length)
{
this._results.pop();
}
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
for (var wy = ty; wy &lt; ty + th; wy++)
2013-11-28 15:57:09 +00:00
{
2014-11-15 20:01:46 +00:00
for (var wx = tx; wx &lt; tx + tw; wx++)
2013-11-28 15:57:09 +00:00
{
2014-11-15 20:01:46 +00:00
var row = this.layer.data[wy];
2015-07-22 14:31:30 +00:00
2015-03-23 23:46:30 +00:00
if (row &amp;&amp; row[wx])
2013-11-28 15:57:09 +00:00
{
2014-11-15 20:01:46 +00:00
if (fetchAll || row[wx].isInteresting(collides, interestingFace))
2013-11-28 15:57:09 +00:00
{
2014-11-15 20:01:46 +00:00
this._results.push(row[wx]);
2013-11-28 15:57:09 +00:00
}
}
}
}
2015-03-23 23:46:30 +00:00
return this._results.slice();
2013-11-28 15:57:09 +00:00
};
2013-11-28 15:57:09 +00:00
/**
2015-01-06 06:57:25 +00:00
* Returns the appropriate tileset for the index, updating the internal cache as required.
* This should only be called if `tilesets[index]` evaluates to undefined.
2014-11-15 20:01:46 +00:00
*
* @method Phaser.TilemapLayer#resolveTileset
* @private
* @param {integer} Tile index
* @return {Phaser.Tileset|null} Returns the associated tileset or null if there is no such mapping.
2013-11-28 15:57:09 +00:00
*/
2015-07-22 14:31:30 +00:00
Phaser.TilemapLayer.prototype.resolveTileset = function (tileIndex) {
2014-11-15 20:01:46 +00:00
var tilesets = this._mc.tilesets;
// Try for dense array if reasonable
2015-03-23 23:46:30 +00:00
if (tileIndex &lt; 2000)
{
while (tilesets.length &lt; tileIndex)
{
2014-11-15 20:01:46 +00:00
tilesets.push(undefined);
}
2013-11-28 15:57:09 +00:00
}
2015-03-23 23:46:30 +00:00
var setIndex = this.map.tiles[tileIndex] &amp;&amp; this.map.tiles[tileIndex][2];
2014-11-15 20:01:46 +00:00
if (setIndex != null) // number: not null or undefined
2013-11-28 15:57:09 +00:00
{
2014-11-15 20:01:46 +00:00
var tileset = this.map.tilesets[setIndex];
2015-03-23 23:46:30 +00:00
if (tileset &amp;&amp; tileset.containsTileIndex(tileIndex))
2014-11-15 20:01:46 +00:00
{
return (tilesets[tileIndex] = tileset);
}
2013-11-28 15:57:09 +00:00
}
2014-11-15 20:01:46 +00:00
return (tilesets[tileIndex] = null);
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
};
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
/**
2015-01-06 06:57:25 +00:00
* The TilemapLayer caches tileset look-ups.
*
* Call this method of clear the cache if tilesets have been added or updated after the layer has been rendered.
2014-11-15 20:01:46 +00:00
*
* @method Phaser.TilemapLayer#resetTilesetCache
* @public
*/
2015-07-22 14:31:30 +00:00
Phaser.TilemapLayer.prototype.resetTilesetCache = function () {
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
var tilesets = this._mc.tilesets;
2015-03-23 23:46:30 +00:00
while (tilesets.length)
{
2014-11-15 20:01:46 +00:00
tilesets.pop();
}
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
};
2014-02-05 06:29:17 +00:00
2015-03-23 23:46:30 +00:00
/**
2016-02-08 17:01:36 +00:00
* This method will set the scale of the tilemap as well as update the underlying block data of this layer.
2015-03-23 23:46:30 +00:00
*
* @method Phaser.TilemapLayer#setScale
* @param {number} [xScale=1] - The scale factor along the X-plane
* @param {number} [yScale] - The scale factor along the Y-plane
*/
2015-07-22 14:31:30 +00:00
Phaser.TilemapLayer.prototype.setScale = function (xScale, yScale) {
2015-03-23 23:46:30 +00:00
xScale = xScale || 1;
yScale = yScale || xScale;
for (var y = 0; y &lt; this.layer.data.length; y++)
{
var row = this.layer.data[y];
for (var x = 0; x &lt; row.length; x++)
{
var tile = row[x];
tile.width = this.map.tileWidth * xScale;
tile.height = this.map.tileHeight * yScale;
tile.worldX = tile.x * tile.width;
tile.worldY = tile.y * tile.height;
}
}
this.scale.setTo(xScale, yScale);
};
2014-11-15 20:01:46 +00:00
/**
2015-01-06 06:57:25 +00:00
* Shifts the contents of the canvas - does extra math so that different browsers agree on the result.
*
* The specified (x/y) will be shifted to (0,0) after the copy and the newly exposed canvas area will need to be filled in.
2014-11-15 20:01:46 +00:00
*
* @method Phaser.TilemapLayer#shiftCanvas
* @private
* @param {CanvasRenderingContext2D} context - The context to shift
* @param {integer} x
* @param {integer} y
*/
2015-07-22 14:31:30 +00:00
Phaser.TilemapLayer.prototype.shiftCanvas = function (context, x, y) {
2014-11-15 20:01:46 +00:00
var canvas = context.canvas;
var copyW = canvas.width - Math.abs(x);
var copyH = canvas.height - Math.abs(y);
// When x/y non-negative
var dx = 0;
var dy = 0;
var sx = x;
var sy = y;
if (x &lt; 0)
2014-02-05 06:29:17 +00:00
{
2014-11-15 20:01:46 +00:00
dx = -x;
sx = 0;
2014-02-05 06:29:17 +00:00
}
2014-11-15 20:01:46 +00:00
if (y &lt; 0)
2013-11-28 15:57:09 +00:00
{
2014-11-15 20:01:46 +00:00
dy = -y;
sy = 0;
}
2014-07-10 19:31:11 +00:00
2015-01-06 06:57:25 +00:00
var copyCanvas = this.renderSettings.copyCanvas;
2015-03-23 23:46:30 +00:00
2015-01-06 06:57:25 +00:00
if (copyCanvas)
{
2015-03-23 23:46:30 +00:00
// Use a second copy buffer, without slice support, for Safari .. again.
2015-01-06 06:57:25 +00:00
// Ensure copy canvas is large enough
2015-03-23 23:46:30 +00:00
if (copyCanvas.width &lt; copyW || copyCanvas.height &lt; copyH)
2015-01-06 06:57:25 +00:00
{
2015-03-23 23:46:30 +00:00
copyCanvas.width = copyW;
copyCanvas.height = copyH;
2015-01-06 06:57:25 +00:00
}
var copyContext = copyCanvas.getContext('2d');
2015-03-23 23:46:30 +00:00
copyContext.clearRect(0, 0, copyW, copyH);
copyContext.drawImage(canvas, dx, dy, copyW, copyH, 0, 0, copyW, copyH);
// clear allows default 'source-over' semantics
context.clearRect(sx, sy, copyW, copyH);
context.drawImage(copyCanvas, 0, 0, copyW, copyH, sx, sy, copyW, copyH);
2015-01-06 06:57:25 +00:00
}
else
{
// Avoids a second copy but flickers in Safari / Safari Mobile
// Ref. https://github.com/photonstorm/phaser/issues/1439
context.save();
context.globalCompositeOperation = 'copy';
context.drawImage(canvas, dx, dy, copyW, copyH, sx, sy, copyW, copyH);
context.restore();
}
2015-03-23 23:46:30 +00:00
2014-11-15 20:01:46 +00:00
};
/**
* Render tiles in the given area given by the virtual tile coordinates biased by the given scroll factor.
* This will constrain the tile coordinates based on wrapping but not physical coordinates.
*
* @method Phaser.TilemapLayer#renderRegion
* @private
* @param {integer} scrollX - Render x offset/scroll.
* @param {integer} scrollY - Render y offset/scroll.
* @param {integer} left - Leftmost column to render.
* @param {integer} top - Topmost row to render.
* @param {integer} right - Rightmost column to render.
* @param {integer} bottom - Bottommost row to render.
*/
Phaser.TilemapLayer.prototype.renderRegion = function (scrollX, scrollY, left, top, right, bottom) {
var context = this.context;
var width = this.layer.width;
var height = this.layer.height;
var tw = this._mc.tileWidth;
var th = this._mc.tileHeight;
var tilesets = this._mc.tilesets;
var lastAlpha = NaN;
if (!this._wrap)
{
if (left &lt;= right) // Only adjust if going to render
2014-07-10 19:31:11 +00:00
{
2014-11-15 20:01:46 +00:00
left = Math.max(0, left);
right = Math.min(width - 1, right);
2014-07-10 19:31:11 +00:00
}
2014-11-15 20:01:46 +00:00
if (top &lt;= bottom)
2014-07-10 19:31:11 +00:00
{
2014-11-15 20:01:46 +00:00
top = Math.max(0, top);
bottom = Math.min(height - 1, bottom);
2014-07-10 19:31:11 +00:00
}
2014-11-15 20:01:46 +00:00
}
// top-left pixel of top-left cell
var baseX = (left * tw) - scrollX;
var baseY = (top * th) - scrollY;
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
// Fix normStartX/normStartY such it is normalized [0..width/height). This allows a simple conditional and decrement to always keep in range [0..width/height) during the loop. The major offset bias is to take care of negative values.
var normStartX = (left + ((1 &lt;&lt; 20) * width)) % width;
var normStartY = (top + ((1 &lt;&lt; 20) * height)) % height;
2014-02-05 06:29:17 +00:00
2014-11-15 20:01:46 +00:00
// tx/ty - are pixel coordinates where tile is drawn
// x/y - is cell location, normalized [0..width/height) in loop
// xmax/ymax - remaining cells to render on column/row
var tx, ty, x, y, xmax, ymax;
2014-07-10 19:31:11 +00:00
2014-11-15 20:01:46 +00:00
context.fillStyle = this.tileColor;
2014-11-15 20:01:46 +00:00
for (y = normStartY, ymax = bottom - top, ty = baseY;
ymax >= 0;
y++, ymax--, ty += th)
{
2014-11-15 20:01:46 +00:00
if (y >= height) { y -= height; }
2014-04-29 14:39:02 +00:00
2014-11-15 20:01:46 +00:00
var row = this.layer.data[y];
for (x = normStartX, xmax = right - left, tx = baseX;
xmax >= 0;
x++, xmax--, tx += tw)
{
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
if (x >= width) { x -= width; }
2014-07-10 19:31:11 +00:00
2014-11-15 20:01:46 +00:00
var tile = row[x];
2015-03-23 23:46:30 +00:00
2014-11-15 20:01:46 +00:00
if (!tile || tile.index &lt; 0)
{
continue;
}
var index = tile.index;
var set = tilesets[index];
2015-03-23 23:46:30 +00:00
2014-11-15 20:01:46 +00:00
if (set === undefined)
{
set = this.resolveTileset(index);
2014-07-10 19:31:11 +00:00
}
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
// Setting the globalAlpha is "surprisingly expensive" in Chrome (38)
2015-03-23 23:46:30 +00:00
if (tile.alpha !== lastAlpha &amp;&amp; !this.debug)
2014-11-15 20:01:46 +00:00
{
context.globalAlpha = tile.alpha;
lastAlpha = tile.alpha;
}
if (set)
{
2015-03-23 23:46:30 +00:00
if (tile.rotation || tile.flipped)
{
context.save();
context.translate(tx + tile.centerX, ty + tile.centerY);
context.rotate(tile.rotation);
if (tile.flipped)
{
context.scale(-1, 1);
}
set.draw(context, -tile.centerX, -tile.centerY, index);
context.restore();
}
else
{
set.draw(context, tx, ty, index);
}
2014-11-15 20:01:46 +00:00
}
else if (this.debugSettings.missingImageFill)
{
context.fillStyle = this.debugSettings.missingImageFill;
context.fillRect(tx, ty, tw, th);
}
2015-03-23 23:46:30 +00:00
if (tile.debug &amp;&amp; this.debugSettings.debuggedTileOverfill)
2014-11-15 20:01:46 +00:00
{
context.fillStyle = this.debugSettings.debuggedTileOverfill;
context.fillRect(tx, ty, tw, th);
}
2013-11-28 15:57:09 +00:00
}
2014-11-15 20:01:46 +00:00
}
};
/**
* Shifts the canvas and render damaged edge tiles.
*
* @method Phaser.TilemapLayer#renderDeltaScroll
* @private
*/
Phaser.TilemapLayer.prototype.renderDeltaScroll = function (shiftX, shiftY) {
var scrollX = this._mc.scrollX;
var scrollY = this._mc.scrollY;
var renderW = this.canvas.width;
var renderH = this.canvas.height;
var tw = this._mc.tileWidth;
var th = this._mc.tileHeight;
// Only cells with coordinates in the "plus" formed by `left &lt;= x &lt;= right` OR `top &lt;= y &lt;= bottom` are drawn. These coordinates may be outside the layer bounds.
// Start in pixels
var left = 0;
var right = -tw;
var top = 0;
var bottom = -th;
if (shiftX &lt; 0) // layer moving left, damage right
{
left = renderW + shiftX; // shiftX neg.
right = renderW - 1;
}
else if (shiftX > 0)
{
// left -> 0
right = shiftX;
}
if (shiftY &lt; 0) // layer moving down, damage top
{
top = renderH + shiftY; // shiftY neg.
bottom = renderH - 1;
}
else if (shiftY > 0)
{
// top -> 0
bottom = shiftY;
}
this.shiftCanvas(this.context, shiftX, shiftY);
// Transform into tile-space
left = Math.floor((left + scrollX) / tw);
right = Math.floor((right + scrollX) / tw);
top = Math.floor((top + scrollY) / th);
bottom = Math.floor((bottom + scrollY) / th);
if (left &lt;= right)
{
// Clear left or right edge
this.context.clearRect(((left * tw) - scrollX), 0, (right - left + 1) * tw, renderH);
var trueTop = Math.floor((0 + scrollY) / th);
var trueBottom = Math.floor((renderH - 1 + scrollY) / th);
this.renderRegion(scrollX, scrollY, left, trueTop, right, trueBottom);
}
2015-07-22 14:31:30 +00:00
2014-11-15 20:01:46 +00:00
if (top &lt;= bottom)
{
// Clear top or bottom edge
this.context.clearRect(0, ((top * th) - scrollY), renderW, (bottom - top + 1) * th);
var trueLeft = Math.floor((0 + scrollX) / tw);
var trueRight = Math.floor((renderW - 1 + scrollX) / tw);
this.renderRegion(scrollX, scrollY, trueLeft, top, trueRight, bottom);
}
};
/**
* Clear and render the entire canvas.
*
* @method Phaser.TilemapLayer#renderFull
* @private
*/
2015-07-22 14:31:30 +00:00
Phaser.TilemapLayer.prototype.renderFull = function () {
2014-11-15 20:01:46 +00:00
var scrollX = this._mc.scrollX;
var scrollY = this._mc.scrollY;
var renderW = this.canvas.width;
var renderH = this.canvas.height;
var tw = this._mc.tileWidth;
var th = this._mc.tileHeight;
var left = Math.floor(scrollX / tw);
var right = Math.floor((renderW - 1 + scrollX) / tw);
var top = Math.floor(scrollY / th);
var bottom = Math.floor((renderH - 1 + scrollY) / th);
this.context.clearRect(0, 0, renderW, renderH);
this.renderRegion(scrollX, scrollY, left, top, right, bottom);
};
/**
* Renders the tiles to the layer canvas and pushes to the display.
*
* @method Phaser.TilemapLayer#render
* @protected
*/
Phaser.TilemapLayer.prototype.render = function () {
var redrawAll = false;
if (!this.visible)
{
return;
}
2014-02-05 06:29:17 +00:00
2014-11-15 20:01:46 +00:00
if (this.dirty || this.layer.dirty)
{
this.layer.dirty = false;
redrawAll = true;
}
var renderWidth = this.canvas.width; // Use Sprite.width/height?
var renderHeight = this.canvas.height;
// Scrolling bias; whole pixels only
var scrollX = this._scrollX | 0;
var scrollY = this._scrollY | 0;
var mc = this._mc;
var shiftX = mc.scrollX - scrollX; // Negative when scrolling right/down
var shiftY = mc.scrollY - scrollY;
2015-03-23 23:46:30 +00:00
if (!redrawAll &amp;&amp;
shiftX === 0 &amp;&amp; shiftY === 0 &amp;&amp;
mc.renderWidth === renderWidth &amp;&amp; mc.renderHeight === renderHeight)
2014-11-15 20:01:46 +00:00
{
// No reason to redraw map, looking at same thing and not invalidated.
return;
}
2015-07-29 14:01:04 +00:00
this.context.save();
2014-11-15 20:01:46 +00:00
mc.scrollX = scrollX;
mc.scrollY = scrollY;
if (mc.renderWidth !== renderWidth || mc.renderHeight !== renderHeight)
{
// Could support automatic canvas resizing
mc.renderWidth = renderWidth;
mc.renderHeight = renderHeight;
}
if (this.debug)
{
this.context.globalAlpha = this.debugSettings.debugAlpha;
2015-03-23 23:46:30 +00:00
2014-11-15 20:01:46 +00:00
if (this.debugSettings.forceFullRedraw)
{
redrawAll = true;
}
}
2015-03-23 23:46:30 +00:00
if (!redrawAll &amp;&amp;
this.renderSettings.enableScrollDelta &amp;&amp;
2014-11-15 20:01:46 +00:00
(Math.abs(shiftX) + Math.abs(shiftY)) &lt; Math.min(renderWidth, renderHeight))
{
this.renderDeltaScroll(shiftX, shiftY);
}
else
{
// Too much change or otherwise requires full render
this.renderFull();
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
}
2015-07-22 14:31:30 +00:00
this.texture.baseTexture.dirty();
2013-11-28 15:57:09 +00:00
this.dirty = false;
2015-03-23 23:46:30 +00:00
this.context.restore();
2013-11-28 15:57:09 +00:00
return true;
};
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* Renders a debug overlay on-top of the canvas. Called automatically by render when `debug` is true.
*
* See `debugSettings` for assorted configuration options.
*
2014-02-05 06:29:17 +00:00
* @method Phaser.TilemapLayer#renderDebug
2014-11-15 20:01:46 +00:00
* @private
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
Phaser.TilemapLayer.prototype.renderDebug = function () {
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
var scrollX = this._mc.scrollX;
var scrollY = this._mc.scrollY;
var context = this.context;
var renderW = this.canvas.width;
var renderH = this.canvas.height;
var width = this.layer.width;
var height = this.layer.height;
var tw = this._mc.tileWidth;
var th = this._mc.tileHeight;
var left = Math.floor(scrollX / tw);
var right = Math.floor((renderW - 1 + scrollX) / tw);
var top = Math.floor(scrollY / th);
var bottom = Math.floor((renderH - 1 + scrollY) / th);
var baseX = (left * tw) - scrollX;
var baseY = (top * th) - scrollY;
var normStartX = (left + ((1 &lt;&lt; 20) * width)) % width;
var normStartY = (top + ((1 &lt;&lt; 20) * height)) % height;
2013-11-28 15:57:09 +00:00
2014-11-15 20:01:46 +00:00
var tx, ty, x, y, xmax, ymax;
2014-02-05 06:29:17 +00:00
2014-11-15 20:01:46 +00:00
context.strokeStyle = this.debugSettings.facingEdgeStroke;
for (y = normStartY, ymax = bottom - top, ty = baseY;
ymax >= 0;
y++, ymax--, ty += th)
2014-02-05 06:29:17 +00:00
{
2014-11-15 20:01:46 +00:00
if (y >= height) { y -= height; }
var row = this.layer.data[y];
2014-02-05 06:29:17 +00:00
2014-11-15 20:01:46 +00:00
for (x = normStartX, xmax = right - left, tx = baseX;
xmax >= 0;
x++, xmax--, tx += tw)
2014-07-10 19:31:11 +00:00
{
2014-11-15 20:01:46 +00:00
if (x >= width) { x -= width; }
var tile = row[x];
if (!tile || tile.index &lt; 0 || !tile.collides)
2014-02-05 06:29:17 +00:00
{
2014-11-15 20:01:46 +00:00
continue;
}
2014-02-05 06:29:17 +00:00
2014-11-15 20:01:46 +00:00
if (this.debugSettings.collidingTileOverfill)
{
context.fillStyle = this.debugSettings.collidingTileOverfill;
context.fillRect(tx, ty, this._mc.cw, this._mc.ch);
}
if (this.debugSettings.facingEdgeStroke)
{
context.beginPath();
if (tile.faceTop)
2014-02-05 06:29:17 +00:00
{
2014-11-15 20:01:46 +00:00
context.moveTo(tx, ty);
context.lineTo(tx + this._mc.cw, ty);
2014-02-05 06:29:17 +00:00
}
2014-11-15 20:01:46 +00:00
if (tile.faceBottom)
2014-02-05 06:29:17 +00:00
{
2014-11-15 20:01:46 +00:00
context.moveTo(tx, ty + this._mc.ch);
context.lineTo(tx + this._mc.cw, ty + this._mc.ch);
2014-02-05 06:29:17 +00:00
}
2014-11-15 20:01:46 +00:00
if (tile.faceLeft)
2014-02-05 06:29:17 +00:00
{
2014-11-15 20:01:46 +00:00
context.moveTo(tx, ty);
context.lineTo(tx, ty + this._mc.ch);
2014-02-05 06:29:17 +00:00
}
2014-11-15 20:01:46 +00:00
if (tile.faceRight)
2014-02-05 06:29:17 +00:00
{
2014-11-15 20:01:46 +00:00
context.moveTo(tx + this._mc.cw, ty);
context.lineTo(tx + this._mc.cw, ty + this._mc.ch);
2014-07-10 19:31:11 +00:00
}
2014-11-15 20:01:46 +00:00
context.stroke();
2014-07-10 19:31:11 +00:00
}
2014-11-15 20:01:46 +00:00
2014-02-05 06:29:17 +00:00
}
}
2013-11-28 15:57:09 +00:00
};
2013-11-28 15:57:09 +00:00
2015-07-22 14:31:30 +00:00
/**
* Flag controlling if the layer tiles wrap at the edges. Only works if the World size matches the Map size.
*
* @property {boolean} wrap
* @memberof Phaser.TilemapLayer
* @public
* @default false
*/
Object.defineProperty(Phaser.TilemapLayer.prototype, "wrap", {
get: function () {
return this._wrap;
},
set: function (value) {
this._wrap = value;
this.dirty = true;
}
});
2013-11-28 15:57:09 +00:00
/**
2014-11-15 20:01:46 +00:00
* Scrolls the map horizontally or returns the current x position.
*
* @property {number} scrollX
* @memberof Phaser.TilemapLayer
* @public
2013-11-28 15:57:09 +00:00
*/
Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollX", {
2013-11-28 15:57:09 +00:00
get: function () {
2014-11-15 20:01:46 +00:00
return this._scrollX;
2013-11-28 15:57:09 +00:00
},
set: function (value) {
2014-11-15 20:01:46 +00:00
this._scrollX = value;
2013-11-28 15:57:09 +00:00
}
});
/**
2014-11-15 20:01:46 +00:00
* Scrolls the map vertically or returns the current y position.
*
* @property {number} scrollY
* @memberof Phaser.TilemapLayer
* @public
2013-11-28 15:57:09 +00:00
*/
Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollY", {
2013-11-28 15:57:09 +00:00
get: function () {
2014-11-15 20:01:46 +00:00
return this._scrollY;
2013-11-28 15:57:09 +00:00
},
set: function (value) {
2014-11-15 20:01:46 +00:00
this._scrollY = value;
2013-11-28 15:57:09 +00:00
}
2014-02-05 06:29:17 +00:00
});
/**
2014-11-15 20:01:46 +00:00
* The width of the collision tiles (in pixels).
*
* @property {integer} collisionWidth
* @memberof Phaser.TilemapLayer
* @public
2014-02-05 06:29:17 +00:00
*/
Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionWidth", {
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-11-15 20:01:46 +00:00
this._mc.cw = value | 0;
2014-02-05 06:29:17 +00:00
this.dirty = true;
}
});
/**
2014-11-15 20:01:46 +00:00
* The height of the collision tiles (in pixels).
*
* @property {integer} collisionHeight
* @memberof Phaser.TilemapLayer
* @public
2014-02-05 06:29:17 +00:00
*/
Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionHeight", {
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-11-15 20:01:46 +00:00
this._mc.ch = value | 0;
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">
2016-04-22 14:15:28 +00:00
Phaser Copyright © 2012-2016 Photon Storm Ltd.
2013-11-28 15:57:09 +00:00
</span>
<br />
<span class="jsdoc-message">
2015-08-24 14:43:45 +00:00
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.2</a>
2016-05-19 11:36:51 +00:00
on Thu May 19 2016 12:35:37 GMT+0100 (GMT Daylight Time) 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) {
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>