mirror of
https://github.com/wassname/phaser.git
synced 2026-07-03 17:10:40 +08:00
Tiled map loader now working much better, rendering, layering properly.
This commit is contained in:
@@ -7,8 +7,10 @@
|
||||
"opacity":1,
|
||||
"properties":
|
||||
{
|
||||
"alpha":"0.8"
|
||||
"alpha":"0.8",
|
||||
"x":"300"
|
||||
},
|
||||
"transparentcolor":"#55ffff",
|
||||
"type":"imagelayer",
|
||||
"visible":true,
|
||||
"width":50,
|
||||
@@ -16,7 +18,7 @@
|
||||
"y":0
|
||||
},
|
||||
{
|
||||
"data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
"height":18,
|
||||
"name":"Tile Layer 3",
|
||||
"opacity":1,
|
||||
"type":"tilelayer",
|
||||
"visible":true,
|
||||
"width":50,
|
||||
"x":0,
|
||||
"y":0
|
||||
}],
|
||||
"orientation":"orthogonal",
|
||||
"properties":
|
||||
@@ -295,6 +308,21 @@
|
||||
"spacing":0,
|
||||
"tileheight":32,
|
||||
"tilewidth":32
|
||||
},
|
||||
{
|
||||
"firstgid":40,
|
||||
"image":"tiles2.png",
|
||||
"imageheight":910,
|
||||
"imagewidth":840,
|
||||
"margin":0,
|
||||
"name":"tiles2",
|
||||
"properties":
|
||||
{
|
||||
|
||||
},
|
||||
"spacing":0,
|
||||
"tileheight":70,
|
||||
"tilewidth":70
|
||||
}],
|
||||
"tilewidth":32,
|
||||
"version":1,
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<tileset firstgid="34" name="coin" tilewidth="32" tileheight="32">
|
||||
<image source="../sprites/coin.png" width="192" height="32"/>
|
||||
</tileset>
|
||||
<tileset firstgid="40" name="tiles2" tilewidth="70" tileheight="70">
|
||||
<image source="tiles2.png" width="840" height="910"/>
|
||||
</tileset>
|
||||
<imagelayer name="Image Layer 1" width="50" height="18">
|
||||
<image source="../sprites/bunny.png" trans="55ffff"/>
|
||||
<properties>
|
||||
@@ -21,15 +24,15 @@
|
||||
<property name="x" value="300"/>
|
||||
</properties>
|
||||
</imagelayer>
|
||||
<layer name="Tile Layer 1" width="50" height="18" visible="0">
|
||||
<layer name="Tile Layer 1" width="50" height="18">
|
||||
<properties>
|
||||
<property name="collides" value="true"/>
|
||||
</properties>
|
||||
<data encoding="base64">
|
||||
AQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAA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ABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAACQAAAAEAAAABAAAAAQAAAAEAAAABAAAACQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAA
|
||||
</data>
|
||||
</layer>
|
||||
<layer name="Tile Layer 2" width="50" height="18" visible="0">
|
||||
<layer name="Tile Layer 2" width="50" height="18">
|
||||
<properties>
|
||||
<property name="collides" value="false"/>
|
||||
</properties>
|
||||
@@ -37,7 +40,7 @@
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup name="Object Layer 1" width="50" height="18" visible="0">
|
||||
<objectgroup name="Object Layer 1" width="50" height="18">
|
||||
<object name="exit" type="door" x="475" y="430" width="44" height="114">
|
||||
<properties>
|
||||
<property name="open" value="false"/>
|
||||
@@ -58,4 +61,9 @@
|
||||
<polyline points="-28,2 52,-55 189,-21 91,-21 75,78 -40,79 -30,3"/>
|
||||
</object>
|
||||
</objectgroup>
|
||||
<layer name="Tile Layer 3" width="50" height="18">
|
||||
<data encoding="base64">
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 139 KiB |
+39
-15
@@ -3,10 +3,18 @@ var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload:
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.tilemap('map', 'assets/maps/super_mario.json', null, Phaser.Tilemap.TILED_JSON);
|
||||
game.load.tileset('tiles', 'assets/maps/super_mario.png', 16, 16);
|
||||
// game.load.tilemap('map', 'assets/maps/super_mario.json', null, Phaser.Tilemap.TILED_JSON);
|
||||
// game.load.tileset('tiles', 'assets/maps/super_mario.png', 16, 16);
|
||||
|
||||
game.load.tilemap('map', 'assets/maps/newtest.json', null, Phaser.Tilemap.TILED_JSON);
|
||||
|
||||
// game.load.image('ground', 'assets/maps/ground_1x1.png');
|
||||
|
||||
game.load.image('ground_1x1', 'assets/maps/ground_1x1.png');
|
||||
game.load.image('walls_1x2', 'assets/maps/walls_1x2.png');
|
||||
game.load.image('tiles2', 'assets/maps/tiles2.png');
|
||||
|
||||
|
||||
// game.load.tilemap('map', 'assets/maps/newtest.json', null, Phaser.Tilemap.TILED_JSON);
|
||||
// game.load.tileset('tiles', 'assets/maps/ground_1x1.png', 32, 32);
|
||||
// game.load.image('phaser', 'assets/sprites/phaser-ship.png');
|
||||
// game.load.image('phaser', 'assets/sprites/mushroom2.png');
|
||||
@@ -18,22 +26,38 @@ function preload() {
|
||||
|
||||
var cursors;
|
||||
var map;
|
||||
|
||||
var layer;
|
||||
var layer2;
|
||||
var layer3;
|
||||
|
||||
var sprite;
|
||||
|
||||
function create() {
|
||||
|
||||
map = game.add.tilemap('map', 'tiles');
|
||||
map = game.add.tilemap('map');
|
||||
|
||||
map.setCollisionByIndex(15);
|
||||
map.setCollisionByIndex(40);
|
||||
map.setCollisionByIndexRange(14, 16);
|
||||
map.setCollisionByIndexRange(20, 25);
|
||||
map.setCollisionByIndexRange(27, 29);
|
||||
map.addTilesetImage('ground_1x1');
|
||||
map.addTilesetImage('walls_1x2');
|
||||
map.addTilesetImage('tiles2');
|
||||
|
||||
layer = map.createLayer(0, 0, 800, 600, 'ShoeBox Tile Grab');
|
||||
layer.debug = true;
|
||||
map.setCollisionByIndexRange(1, 12);
|
||||
map.setCollisionByIndex(100, 'Tile Layer 3');
|
||||
|
||||
// map.setCollisionByIndex(15);
|
||||
// map.setCollisionByIndex(40);
|
||||
// map.setCollisionByIndexRange(14, 16);
|
||||
// map.setCollisionByIndexRange(20, 25);
|
||||
// map.setCollisionByIndexRange(27, 29);
|
||||
|
||||
layer2 = map.createLayer('Tile Layer 2');
|
||||
layer = map.createLayer('Tile Layer 1');
|
||||
layer3 = map.createLayer('Tile Layer 3');
|
||||
|
||||
// layer.debug = true;
|
||||
layer3.debug = true;
|
||||
|
||||
layer.resizeWorld();
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +65,6 @@ function create() {
|
||||
// layer.cameraOffset.x = 400;
|
||||
// layer.alpha = 0.5;
|
||||
|
||||
layer.resizeWorld();
|
||||
|
||||
sprite = game.add.sprite(260, 100, 'phaser');
|
||||
sprite.anchor.setTo(0.5, 0.5);
|
||||
@@ -105,7 +128,8 @@ function update() {
|
||||
layer.scrollY += 4;
|
||||
}
|
||||
*/
|
||||
game.physics.collide(sprite, layer);
|
||||
// game.physics.collide(sprite, layer);
|
||||
game.physics.collide(sprite, layer3);
|
||||
|
||||
sprite.body.velocity.x = 0;
|
||||
sprite.body.velocity.y = 0;
|
||||
@@ -177,7 +201,7 @@ function render() {
|
||||
// game.debug.renderText(sprite.x, 32, 32);
|
||||
// game.debug.renderText(sprite.y, 32, 48);
|
||||
|
||||
game.debug.renderText(layer.scrollX, 32, 32);
|
||||
game.debug.renderText(layer.scrollY, 32, 48);
|
||||
// game.debug.renderText(layer.scrollX, 32, 32);
|
||||
// game.debug.renderText(layer.scrollY, 32, 48);
|
||||
|
||||
}
|
||||
+149
-66
@@ -12,9 +12,8 @@
|
||||
* @constructor
|
||||
* @param {Phaser.Game} game - Game reference to the currently running game.
|
||||
* @param {string} [key] - The key of the tilemap data as stored in the Cache.
|
||||
* @param {object|string} tilesets - An object mapping Cache.tileset keys with the tileset names in the JSON file. If a string is provided that will be used.
|
||||
*/
|
||||
Phaser.Tilemap = function (game, key, tilesets) {
|
||||
Phaser.Tilemap = function (game, key) {
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} game - A reference to the currently running Game.
|
||||
@@ -28,6 +27,21 @@ Phaser.Tilemap = function (game, key, tilesets) {
|
||||
|
||||
var data = Phaser.TilemapParser.parse(this.game, key);
|
||||
|
||||
if (data === null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.width = data.width;
|
||||
this.height = data.height;
|
||||
this.tileWidth = data.tileWidth;
|
||||
this.tileHeight = data.tileHeight;
|
||||
this.orientation = data.orientation;
|
||||
this.version = data.version;
|
||||
this.properties = data.properties;
|
||||
this.widthInPixels = data.widthInPixels;
|
||||
this.heightInPixels = data.heightInPixels;
|
||||
|
||||
/**
|
||||
* @property {array} layers - An array of Tilemap layer data.
|
||||
*/
|
||||
@@ -38,6 +52,11 @@ Phaser.Tilemap = function (game, key, tilesets) {
|
||||
*/
|
||||
this.tilesets = data.tilesets;
|
||||
|
||||
/**
|
||||
* @property {array} tiles - The super array of Tiles.
|
||||
*/
|
||||
this.tiles = data.tiles;
|
||||
|
||||
/**
|
||||
* @property {array} objects - An array of Tiled Object Layers.
|
||||
*/
|
||||
@@ -92,49 +111,6 @@ Phaser.Tilemap.TILED_JSON = 1;
|
||||
|
||||
Phaser.Tilemap.prototype = {
|
||||
|
||||
|
||||
|
||||
addTilesets: function (tilesets) {
|
||||
|
||||
// { "TiledKey": "TilesetKey" }
|
||||
|
||||
// parse the tilesets array and set-up gid mappings
|
||||
|
||||
// "tilesets":[
|
||||
// {
|
||||
// "firstgid":1,
|
||||
// "image":"SuperMarioBros-World1-1_bank.png",
|
||||
// "imageheight":64,
|
||||
// "imagewidth":176,
|
||||
// "margin":0,
|
||||
// "name":"SuperMarioBros-World1-1_bank.png",
|
||||
// "properties":
|
||||
// {
|
||||
|
||||
// },
|
||||
// "spacing":0,
|
||||
// "tileheight":16,
|
||||
// "tilewidth":16
|
||||
// }],
|
||||
|
||||
//this.layers = this.game.cache.getTilemapData(key).layers;
|
||||
|
||||
var mapTilesets = this.game.cache.getTilemapData(this.key).tilesets;
|
||||
|
||||
for (var tileset in tilesets)
|
||||
{
|
||||
for (var i = 0; i < mapTilesets.length; i++)
|
||||
{
|
||||
if (mapTilesets[i].name === tilesets[tileset])
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates an empty map of the given dimensions.
|
||||
*
|
||||
@@ -177,39 +153,82 @@ Phaser.Tilemap.prototype = {
|
||||
|
||||
},
|
||||
|
||||
addTilesetImage: function (tileset, key) {
|
||||
|
||||
if (typeof key === 'undefined')
|
||||
{
|
||||
if (typeof tileset === 'string')
|
||||
{
|
||||
key = tileset;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof tileset === 'string')
|
||||
{
|
||||
tileset = this.getTilesetIndex(tileset);
|
||||
}
|
||||
|
||||
if (this.tilesets[tileset])
|
||||
{
|
||||
this.tilesets[tileset].image = this.game.cache.getImage(key);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a new TilemapLayer object. By default TilemapLayers are fixed to the camera.
|
||||
*
|
||||
* @method Phaser.Tileset#createLayer
|
||||
* @param {number} x - Camera Offset X position of the layer.
|
||||
* @param {number} y - Camera Offset Y position of the layer.
|
||||
* @param {number} width - The rendered width of the layer, should never be wider than Game.width.
|
||||
* @param {number} height - The rendered height of the layer, should never be wider than Game.height.
|
||||
* @param {number|string} layer - The layer number, or if a string is given the layer name, within the map data that this TilemapLayer represents.
|
||||
* @param {Phaser.Tileset|string} [tileset] - The Phaser.Tileset this layer will use for rendering. If none given it will render using rectangles.
|
||||
* @param {number|string} layer - The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents.
|
||||
* @param {number} [width] - The rendered width of the layer, should never be wider than Game.width. If not given it will be set to Game.width.
|
||||
* @param {number} [height] - The rendered height of the layer, should never be wider than Game.height. If not given it will be set to Game.height.
|
||||
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
|
||||
* @return {Phaser.TilemapLayer} The TilemapLayer object. This is an extension of Phaser.Sprite and can be moved around the display list accordingly.
|
||||
*/
|
||||
createLayer: function (x, y, width, height, layer, tileset, group) {
|
||||
createLayer: function (layer, width, height, group) {
|
||||
|
||||
if (typeof width === 'undefined') { width = this.game.width; }
|
||||
if (typeof height === 'undefined') { height = this.game.height; }
|
||||
if (typeof group === 'undefined') { group = this.game.world; }
|
||||
|
||||
return group.add(new Phaser.TilemapLayer(this.game, x, y, width, height, this, layer, tileset));
|
||||
var index = layer;
|
||||
|
||||
if (typeof layer === 'string')
|
||||
{
|
||||
index = this.getLayerIndex(layer);
|
||||
}
|
||||
|
||||
if (index === null || index > this.layers.length)
|
||||
{
|
||||
console.warn('Tilemap.createLayer: Invalid layer ID given: ' + index);
|
||||
return;
|
||||
}
|
||||
|
||||
return group.add(new Phaser.TilemapLayer(this.game, this, index, width, height));
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the layer index based on a layer name.
|
||||
*
|
||||
* @method Phaser.Tileset#getLayerIndex
|
||||
* @param {string} name - The name of the layer to get.
|
||||
* @return {number} The index of the layer in this tilemap, or null if not found.
|
||||
* @method Phaser.Tileset#getIndex
|
||||
* @param {array} location - The local array to search.
|
||||
* @param {string} name - The name of the array element to get.
|
||||
* @return {number} The index of the element in the array, or null if not found.
|
||||
*/
|
||||
getLayerIndex: function (name) {
|
||||
getIndex: function (location, name) {
|
||||
|
||||
for (var i = 0; i < this.layers.length; i++)
|
||||
for (var i = 0; i < location.length; i++)
|
||||
{
|
||||
if (this.layers[i].name === name)
|
||||
if (location[i].name === name)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@@ -219,18 +238,68 @@ Phaser.Tilemap.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the layer index based on its name.
|
||||
*
|
||||
* @method Phaser.Tileset#getLayerIndex
|
||||
* @param {string} name - The name of the layer to get.
|
||||
* @return {number} The index of the layer in this tilemap, or null if not found.
|
||||
*/
|
||||
getLayerIndex: function (name) {
|
||||
|
||||
return this.getIndex(this.layers, name);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the tileset index based on its name.
|
||||
*
|
||||
* @method Phaser.Tileset#getTilesetIndex
|
||||
* @param {string} name - The name of the tileset to get.
|
||||
* @return {number} The index of the tileset in this tilemap, or null if not found.
|
||||
*/
|
||||
getTilesetIndex: function (name) {
|
||||
|
||||
return this.getIndex(this.tilesets, name);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the image index based on its name.
|
||||
*
|
||||
* @method Phaser.Tileset#getImageIndex
|
||||
* @param {string} name - The name of the image to get.
|
||||
* @return {number} The index of the image in this tilemap, or null if not found.
|
||||
*/
|
||||
getImageIndex: function (name) {
|
||||
|
||||
return this.getIndex(this.images, name);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the object index based on its name.
|
||||
*
|
||||
* @method Phaser.Tileset#getObjectIndex
|
||||
* @param {string} name - The name of the object to get.
|
||||
* @return {number} The index of the object in this tilemap, or null if not found.
|
||||
*/
|
||||
getObjectIndex: function (name) {
|
||||
|
||||
return this.getIndex(this.objects, name);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets collision values on a range of tiles in the set.
|
||||
*
|
||||
* @method Phaser.Tileset#setCollisionByIndexRange
|
||||
* @param {number} start - The first index of the tile on the layer.
|
||||
* @param {number} stop - The last index of the tile on the layer.
|
||||
* @param {number} layer - The layer to operate on.
|
||||
* @param {number|string|Phaser.TilemapLayer} layer - The layer to operate on. If not given will default to this.currentLayer.
|
||||
*/
|
||||
setCollisionByIndexRange: function (start, stop, layer) {
|
||||
|
||||
if (typeof layer === "undefined") { layer = this.currentLayer; }
|
||||
|
||||
if (start > stop)
|
||||
{
|
||||
return;
|
||||
@@ -238,11 +307,11 @@ Phaser.Tilemap.prototype = {
|
||||
|
||||
for (var i = start; i <= stop; i++)
|
||||
{
|
||||
this.setCollisionByIndex(i, layer, false);
|
||||
var index = this.setCollisionByIndex(i, layer, false);
|
||||
}
|
||||
|
||||
// Now re-calculate interesting faces
|
||||
this.calculateFaces(layer);
|
||||
this.calculateFaces(index);
|
||||
|
||||
},
|
||||
|
||||
@@ -251,12 +320,24 @@ Phaser.Tilemap.prototype = {
|
||||
*
|
||||
* @method Phaser.Tileset#setCollisionByIndex
|
||||
* @param {number} index - The index of the tile on the layer.
|
||||
* @param {number} layer - The layer to operate on.
|
||||
* @param {number|string|Phaser.TilemapLayer} layer - The layer to operate on. If not given will default to this.currentLayer.
|
||||
* @param {boolean} [recalculate=true] - Recalculates the tile faces after the update.
|
||||
*/
|
||||
setCollisionByIndex: function (index, layer, recalculate) {
|
||||
|
||||
if (typeof layer === "undefined") { layer = this.currentLayer; }
|
||||
if (typeof layer === 'undefined')
|
||||
{
|
||||
layer = this.currentLayer;
|
||||
}
|
||||
else if (typeof layer === 'string')
|
||||
{
|
||||
layer = this.getLayerIndex(layer);
|
||||
}
|
||||
else if (layer instanceof Phaser.TilemapLayer)
|
||||
{
|
||||
layer = layer.index;
|
||||
}
|
||||
|
||||
if (typeof recalculate === "undefined") { recalculate = true; }
|
||||
|
||||
for (var y = 0; y < this.layers[layer].height ; y++)
|
||||
@@ -282,6 +363,8 @@ Phaser.Tilemap.prototype = {
|
||||
this.calculateFaces(layer);
|
||||
}
|
||||
|
||||
return layer;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
+159
-242
@@ -10,25 +10,37 @@
|
||||
* @class Phaser.TilemapLayer
|
||||
* @constructor
|
||||
* @param {Phaser.Game} game - Game reference to the currently running game.
|
||||
* @param {number} x - The x coordinate of this layer.
|
||||
* @param {number} y - The y coordinate of this layer.
|
||||
* @param {number} renderWidth - Width of the renderable area of the layer.
|
||||
* @param {number} renderHeight - Height of the renderable area of the layer.
|
||||
* @param {Phaser.Tilemap} tilemap - The tilemap to which this layer belongs.
|
||||
* @param {number|string} layer - The layer within the tilemap this TilemapLayer represents.
|
||||
* @param {Phaser.Tileset|string} [tileset] - The Tileset used for rendering. If none given the tiles are drawn as rectangles.
|
||||
* @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.
|
||||
*/
|
||||
Phaser.TilemapLayer = function (game, x, y, renderWidth, renderHeight, tilemap, layer, tileset) {
|
||||
Phaser.TilemapLayer = function (game, tilemap, index, width, height) {
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} game - A reference to the currently running Game.
|
||||
*/
|
||||
this.game = game;
|
||||
|
||||
|
||||
/**
|
||||
* @property {Phaser.Tilemap} map - The Tilemap to which this layer is bound.
|
||||
*/
|
||||
this.map = tilemap;
|
||||
|
||||
/**
|
||||
* @property {number} index - The index of this layer within the Tilemap.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
this.canvas = Phaser.Canvas.create(renderWidth, renderHeight);
|
||||
this.canvas = Phaser.Canvas.create(width, height);
|
||||
|
||||
/**
|
||||
* @property {CanvasRenderingContext2D} context - The 2d context of the canvas.
|
||||
@@ -48,9 +60,14 @@ Phaser.TilemapLayer = function (game, x, y, renderWidth, renderHeight, tilemap,
|
||||
/**
|
||||
* @property {Phaser.Frame} textureFrame - Dimensions of the renderable area.
|
||||
*/
|
||||
this.textureFrame = new Phaser.Frame(0, 0, 0, renderWidth, renderHeight, 'tilemapLayer', game.rnd.uuid());
|
||||
this.textureFrame = new Phaser.Frame(0, 0, 0, width, height, 'tilemapLayer', game.rnd.uuid());
|
||||
|
||||
Phaser.Sprite.call(this, this.game, x, y, this.texture, this.textureFrame);
|
||||
Phaser.Sprite.call(this, this.game, 0, 0, this.texture, this.textureFrame);
|
||||
|
||||
/**
|
||||
* @property {string} name - The name of the layer.
|
||||
*/
|
||||
this.name = '';
|
||||
|
||||
/**
|
||||
* @property {number} type - The const type of this object.
|
||||
@@ -68,32 +85,7 @@ Phaser.TilemapLayer = function (game, x, y, renderWidth, renderHeight, tilemap,
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
this.cameraOffset = new Phaser.Point(x, y);
|
||||
|
||||
/**
|
||||
* @property {Phaser.Tileset} tileset - The tile set used for rendering.
|
||||
*/
|
||||
this.tileset = null;
|
||||
|
||||
/**
|
||||
* @property {number} tileWidth - The width of a single tile in pixels.
|
||||
*/
|
||||
this.tileWidth = 0;
|
||||
|
||||
/**
|
||||
* @property {number} tileHeight - The height of a single tile in pixels.
|
||||
*/
|
||||
this.tileHeight = 0;
|
||||
|
||||
/**
|
||||
* @property {number} tileMargin - The margin around the tiles.
|
||||
*/
|
||||
this.tileMargin = 0;
|
||||
|
||||
/**
|
||||
* @property {number} tileSpacing - The spacing around the tiles.
|
||||
*/
|
||||
this.tileSpacing = 0;
|
||||
this.cameraOffset = new Phaser.Point(0, 0);
|
||||
|
||||
/**
|
||||
* @property {string} tileColor - If no tile set is given the tiles will be rendered as rectangles in this color. Provide in hex or rgb/rgba string format.
|
||||
@@ -131,28 +123,6 @@ Phaser.TilemapLayer = function (game, x, y, renderWidth, renderHeight, tilemap,
|
||||
*/
|
||||
this.debugFillColor = 'rgba(0, 255, 0, 0.2)';
|
||||
|
||||
/**
|
||||
* @property {number} widthInPixels - Do NOT recommend changing after the map is loaded!
|
||||
* @readonly
|
||||
*/
|
||||
this.widthInPixels = 0;
|
||||
|
||||
/**
|
||||
* @property {number} heightInPixels - Do NOT recommend changing after the map is loaded!
|
||||
* @readonly
|
||||
*/
|
||||
this.heightInPixels = 0;
|
||||
|
||||
/**
|
||||
* @property {number} renderWidth - The width of the area being rendered.
|
||||
*/
|
||||
this.renderWidth = renderWidth;
|
||||
|
||||
/**
|
||||
* @property {number} renderHeight - The height of the area being rendered.
|
||||
*/
|
||||
this.renderHeight = renderHeight;
|
||||
|
||||
/**
|
||||
* @property {number} scrollFactorX - speed at which this layer scrolls
|
||||
* horizontally, relative to the camera (e.g. scrollFactorX of 0.5 scrolls
|
||||
@@ -169,26 +139,23 @@ Phaser.TilemapLayer = function (game, x, y, renderWidth, renderHeight, tilemap,
|
||||
*/
|
||||
this.scrollFactorY = 1;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Tilemap} tilemap - The Tilemap to which this layer is bound.
|
||||
*/
|
||||
this.tilemap = tilemap;
|
||||
|
||||
/**
|
||||
* @property {object} layer - The layer object within the Tilemap that this layer represents.
|
||||
*/
|
||||
this.layer = null;
|
||||
|
||||
/**
|
||||
* @property {number} index - The index of this layer within the Tilemap.
|
||||
*/
|
||||
this.index = 0;
|
||||
|
||||
/**
|
||||
* @property {boolean} dirty - Flag controlling when to re-render the layer.
|
||||
*/
|
||||
this.dirty = true;
|
||||
|
||||
/**
|
||||
* @property {number} _cw - Local collision var.
|
||||
* @private
|
||||
*/
|
||||
this._cw = tilemap.tileWidth;
|
||||
|
||||
/**
|
||||
* @property {number} _ch - Local collision var.
|
||||
* @private
|
||||
*/
|
||||
this._ch = tilemap.tileHeight;
|
||||
|
||||
/**
|
||||
* @property {number} _ga - Local render loop var to help avoid gc spikes.
|
||||
* @private
|
||||
@@ -303,12 +270,7 @@ Phaser.TilemapLayer = function (game, x, y, renderWidth, renderHeight, tilemap,
|
||||
*/
|
||||
this._prevY = 0;
|
||||
|
||||
this.updateMapData(layer);
|
||||
|
||||
if (tileset instanceof Phaser.Tileset || typeof tileset === 'string')
|
||||
{
|
||||
this.updateTileset(tileset);
|
||||
}
|
||||
this.updateMax();
|
||||
|
||||
};
|
||||
|
||||
@@ -342,63 +304,7 @@ Phaser.TilemapLayer.prototype.postUpdate = function () {
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.resizeWorld = function () {
|
||||
|
||||
this.game.world.setBounds(0, 0, this.widthInPixels, this.heightInPixels);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the Tileset data.
|
||||
*
|
||||
* @method Phaser.TilemapLayer#updateTileset
|
||||
* @memberof Phaser.TilemapLayer
|
||||
* @param {Phaser.Tileset|string} tileset - The tileset to use for this layer.
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.updateTileset = function (tileset) {
|
||||
|
||||
if (tileset instanceof Phaser.Tileset)
|
||||
{
|
||||
this.tileset = tileset;
|
||||
}
|
||||
else if (typeof tileset === 'string')
|
||||
{
|
||||
this.tileset = this.game.cache.getTileset(tileset);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.tileWidth = this.tileset.tileWidth;
|
||||
this.tileHeight = this.tileset.tileHeight;
|
||||
this.tileMargin = this.tileset.tileMargin;
|
||||
this.tileSpacing = this.tileset.tileSpacing;
|
||||
|
||||
// Need to work out the firstgid
|
||||
|
||||
this.updateMax();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the Tilemap data.
|
||||
*
|
||||
* @method Phaser.TilemapLayer#updateMapData
|
||||
* @memberof Phaser.TilemapLayer
|
||||
* @param {number} layerIndex - The layer index within the map.
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.updateMapData = function (layerIndex) {
|
||||
|
||||
if (typeof layerIndex === 'string')
|
||||
{
|
||||
layerIndex = tilemap.getLayerIndex(layerIndex);
|
||||
}
|
||||
|
||||
this.layer = this.tilemap.layers[layerIndex];
|
||||
this.tileWidth = this.layer.tileWidth;
|
||||
this.tileHeight = this.layer.tileHeight;
|
||||
this.index = layerIndex;
|
||||
this.updateMax();
|
||||
this.tilemap.layers[layerIndex].dirty = true;
|
||||
this.game.world.setBounds(0, 0, this.layer.widthInPixels, this.layer.heightInPixels);
|
||||
|
||||
}
|
||||
|
||||
@@ -501,9 +407,9 @@ Phaser.TilemapLayer.prototype._unfixY = function(y) {
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.getTileX = function (x) {
|
||||
|
||||
var tileWidth = this.tileWidth * this.scale.x;
|
||||
// var tileWidth = this.tileWidth * this.scale.x;
|
||||
|
||||
return this.game.math.snapToFloor(this._fixX(x), tileWidth) / tileWidth;
|
||||
return this.game.math.snapToFloor(this._fixX(x), this.map.tileWidth) / this.map.tileWidth;
|
||||
|
||||
}
|
||||
|
||||
@@ -516,9 +422,9 @@ Phaser.TilemapLayer.prototype.getTileX = function (x) {
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.getTileY = function (y) {
|
||||
|
||||
var tileHeight = this.tileHeight * this.scale.y;
|
||||
// var tileHeight = this.tileHeight * this.scale.y;
|
||||
|
||||
return this.game.math.snapToFloor(this._fixY(y), tileHeight) / tileHeight;
|
||||
return this.game.math.snapToFloor(this._fixY(y), this.map.tileHeight) / this.map.tileHeight;
|
||||
|
||||
}
|
||||
|
||||
@@ -528,7 +434,8 @@ Phaser.TilemapLayer.prototype.getTileY = function (y) {
|
||||
* @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.
|
||||
* @return {Phaser.Tile} The tile with specific properties.
|
||||
* @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.
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.getTileXY = function (x, y, point) {
|
||||
|
||||
@@ -552,11 +459,6 @@ Phaser.TilemapLayer.prototype.getTileXY = function (x, y, point) {
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides) {
|
||||
|
||||
if (this.tilemap === null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 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; }
|
||||
|
||||
@@ -564,32 +466,26 @@ Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides
|
||||
x = this._fixX(x);
|
||||
y = this._fixY(y);
|
||||
|
||||
if (width > this.widthInPixels)
|
||||
if (width > this.layer.widthInPixels)
|
||||
{
|
||||
width = this.widthInPixels;
|
||||
width = this.layer.widthInPixels;
|
||||
}
|
||||
|
||||
if (height > this.heightInPixels)
|
||||
if (height > this.layer.heightInPixels)
|
||||
{
|
||||
height = this.heightInPixels;
|
||||
height = this.layer.heightInPixels;
|
||||
}
|
||||
|
||||
var tileWidth = this.tileWidth * this.scale.x;
|
||||
var tileHeight = this.tileHeight * this.scale.y;
|
||||
|
||||
// Convert the pixel values into tile coordinates
|
||||
this._tx = this.game.math.snapToFloor(x, tileWidth) / tileWidth;
|
||||
this._ty = this.game.math.snapToFloor(y, tileHeight) / tileHeight;
|
||||
this._tw = (this.game.math.snapToCeil(width, tileWidth) + tileWidth) / tileWidth;
|
||||
this._th = (this.game.math.snapToCeil(height, tileHeight) + tileHeight) / tileHeight;
|
||||
this._tx = this.game.math.snapToFloor(x, this.map.tileWidth) / this.map.tileWidth;
|
||||
this._ty = this.game.math.snapToFloor(y, this.map.tileHeight) / this.map.tileHeight;
|
||||
this._tw = (this.game.math.snapToCeil(width, this.map.tileWidth) + this.map.tileWidth) / this.map.tileWidth;
|
||||
this._th = (this.game.math.snapToCeil(height, this.map.tileHeight) + this.map.tileHeight) / this.map.tileHeight;
|
||||
|
||||
// This should apply the layer x/y here
|
||||
this._results.length = 0;
|
||||
|
||||
// var _index = 0;
|
||||
var _tile = null;
|
||||
// var sx = 0;
|
||||
// var sy = 0;
|
||||
|
||||
for (var wy = this._ty; wy < this._ty + this._th; wy++)
|
||||
{
|
||||
@@ -601,26 +497,21 @@ Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides
|
||||
|
||||
if (_tile)
|
||||
{
|
||||
// sx = this.tileWidth * this.scale.x;
|
||||
// sy = this.tileHeight * this.scale.y;
|
||||
|
||||
if (collides === false || (collides && _tile.collides))
|
||||
{
|
||||
// convert tile coordinates back to camera space for return
|
||||
var _wx = this._unfixX(wx * tileWidth) / this.tileWidth;
|
||||
var _wy = this._unfixY(wy * tileHeight) / this.tileHeight;
|
||||
var _wx = this._unfixX(wx * this.map.tileWidth) / this.map.tileWidth;
|
||||
var _wy = this._unfixY(wy * this.map.tileHeight) / this.map.tileHeight;
|
||||
|
||||
this._results.push({
|
||||
x: _wx * tileWidth,
|
||||
y: _wy * tileHeight,
|
||||
right: (_wx * tileWidth) + tileWidth,
|
||||
bottom: (_wy * tileHeight) + tileHeight,
|
||||
x: _wx * this.map.tileWidth,
|
||||
y: _wy * this.map.tileHeight,
|
||||
right: (_wx * this.map.tileWidth) + this.map.tileWidth,
|
||||
bottom: (_wy * this.map.tileHeight) + this.map.tileHeight,
|
||||
tile: _tile
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -640,7 +531,6 @@ Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides
|
||||
* @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.
|
||||
* @return {array} Array with tiles informations (each contains x, y, and the tile).
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.debugGetTiles = function (x, y, width, height, collides) {
|
||||
|
||||
if (this.tilemap === null)
|
||||
@@ -770,6 +660,7 @@ Phaser.TilemapLayer.prototype.debugGetTiles = function (x, y, width, height, col
|
||||
return this._results;
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal function to update maximum values.
|
||||
@@ -778,8 +669,8 @@ Phaser.TilemapLayer.prototype.debugGetTiles = function (x, y, width, height, col
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.updateMax = function () {
|
||||
|
||||
this._maxX = this.game.math.ceil(this.canvas.width / this.tileWidth) + 1;
|
||||
this._maxY = this.game.math.ceil(this.canvas.height / this.tileHeight) + 1;
|
||||
this._maxX = this.game.math.ceil(this.canvas.width / this.map.tileWidth) + 1;
|
||||
this._maxY = this.game.math.ceil(this.canvas.height / this.map.tileHeight) + 1;
|
||||
|
||||
if (this.layer)
|
||||
{
|
||||
@@ -792,14 +683,11 @@ Phaser.TilemapLayer.prototype.updateMax = function () {
|
||||
{
|
||||
this._maxY = this.layer.height;
|
||||
}
|
||||
|
||||
this.widthInPixels = this.layer.width * this.tileWidth;
|
||||
this.heightInPixels = this.layer.height * this.tileHeight;
|
||||
}
|
||||
|
||||
this.dirty = true;
|
||||
|
||||
// console.log('updateMax', this._maxX, this._maxY, 'px', this.widthInPixels, this.heightInPixels, 'rwh', this.width, this.height);
|
||||
console.log('updateMax', this._maxX, this._maxY, 'px', this.layer.widthInPixels, this.layer.heightInPixels, 'rwh', this.layer.width, this.layer.height);
|
||||
|
||||
}
|
||||
|
||||
@@ -810,12 +698,12 @@ Phaser.TilemapLayer.prototype.updateMax = function () {
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.render = function () {
|
||||
|
||||
if (this.tilemap && this.tilemap.layers[this.index].dirty)
|
||||
if (this.layer.dirty)
|
||||
{
|
||||
this.dirty = true;
|
||||
}
|
||||
|
||||
if (!this.dirty || !this.tilemap || !this.visible)
|
||||
if (!this.dirty || !this.visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -823,57 +711,84 @@ Phaser.TilemapLayer.prototype.render = function () {
|
||||
this._prevX = this._dx;
|
||||
this._prevY = this._dy;
|
||||
|
||||
this._dx = -(this._x - (this._startX * this.tileWidth));
|
||||
this._dy = -(this._y - (this._startY * this.tileHeight));
|
||||
this._dx = -(this._x - (this._startX * this.map.tileWidth));
|
||||
this._dy = -(this._y - (this._startY * this.map.tileHeight));
|
||||
|
||||
this._tx = this._dx;
|
||||
this._ty = this._dy;
|
||||
|
||||
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
||||
this.context.fillStyle = this.tileColor;
|
||||
|
||||
var tile;
|
||||
var set;
|
||||
var ox = 0;
|
||||
var oy = 0;
|
||||
|
||||
if (this.debug)
|
||||
{
|
||||
this.context.globalAlpha = this.debugAlpha;
|
||||
}
|
||||
|
||||
if (!this.tileset)
|
||||
{
|
||||
this.context.fillStyle = this.tileColor;
|
||||
}
|
||||
|
||||
for (var y = this._startY, lenY = this._startY + this._maxY; y < lenY; y++)
|
||||
{
|
||||
this._column = this.layer.data[y];
|
||||
|
||||
for (var x = this._startX, lenX = this._startX + this._maxX; x < lenX; x++)
|
||||
{
|
||||
var tile = this._column[x];
|
||||
if (this._column[x])
|
||||
{
|
||||
tile = this._column[x];
|
||||
|
||||
if (tile && this.tileset)
|
||||
{
|
||||
this.context.drawImage(
|
||||
this.tileset.image,
|
||||
this.tileset.getTileX(tile.index),
|
||||
this.tileset.getTileY(tile.index),
|
||||
this.tileWidth,
|
||||
this.tileHeight,
|
||||
Math.floor(this._tx),
|
||||
Math.floor(this._ty),
|
||||
this.tileWidth,
|
||||
this.tileHeight
|
||||
);
|
||||
}
|
||||
else if (tile)
|
||||
{
|
||||
this.context.fillRect(Math.floor(this._tx), Math.floor(this._ty), this.tileWidth, this.tileHeight);
|
||||
if (this.map.tiles[tile.index])
|
||||
{
|
||||
set = this.map.tilesets[this.map.tiles[tile.index][2]]
|
||||
|
||||
if (set.image)
|
||||
{
|
||||
if (set.tileWidth !== this.map.tileWidth || set.tileHeight !== this.map.tileHeight)
|
||||
{
|
||||
// TODO: Smaller sized tile check
|
||||
this.context.drawImage(
|
||||
this.map.tilesets[this.map.tiles[tile.index][2]].image,
|
||||
this.map.tiles[tile.index][0],
|
||||
this.map.tiles[tile.index][1],
|
||||
set.tileWidth,
|
||||
set.tileHeight,
|
||||
Math.floor(this._tx),
|
||||
Math.floor(this._ty) - (set.tileHeight - this.map.tileHeight),
|
||||
set.tileWidth,
|
||||
set.tileHeight
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.context.drawImage(
|
||||
this.map.tilesets[this.map.tiles[tile.index][2]].image,
|
||||
this.map.tiles[tile.index][0],
|
||||
this.map.tiles[tile.index][1],
|
||||
this.map.tileWidth,
|
||||
this.map.tileHeight,
|
||||
Math.floor(this._tx),
|
||||
Math.floor(this._ty),
|
||||
this.map.tileWidth,
|
||||
this.map.tileHeight
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.context.fillRect(Math.floor(this._tx), Math.floor(this._ty), this.map.tileWidth, this.map.tileHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._tx += this.tileWidth;
|
||||
this._tx += this.map.tileWidth;
|
||||
|
||||
}
|
||||
|
||||
this._tx = this._dx;
|
||||
this._ty += this.tileHeight;
|
||||
this._ty += this.map.tileHeight;
|
||||
|
||||
}
|
||||
|
||||
@@ -890,11 +805,7 @@ Phaser.TilemapLayer.prototype.render = function () {
|
||||
}
|
||||
|
||||
this.dirty = false;
|
||||
|
||||
if (this.tilemap.layers[this.index].dirty)
|
||||
{
|
||||
this.tilemap.layers[this.index].dirty = false;
|
||||
}
|
||||
this.layer.dirty = false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -913,6 +824,8 @@ Phaser.TilemapLayer.prototype.renderDebug = function () {
|
||||
this.context.strokeStyle = this.debugColor;
|
||||
this.context.fillStyle = this.debugFillColor;
|
||||
|
||||
var set;
|
||||
|
||||
for (var y = this._startY, lenY = this._startY + this._maxY; y < lenY; y++)
|
||||
{
|
||||
this._column = this.layer.data[y];
|
||||
@@ -923,11 +836,13 @@ Phaser.TilemapLayer.prototype.renderDebug = function () {
|
||||
|
||||
if (tile && (tile.faceTop || tile.faceBottom || tile.faceLeft || tile.faceRight))
|
||||
{
|
||||
set = this.map.tilesets[this.map.tiles[tile.index][2]]
|
||||
|
||||
this._tx = Math.floor(this._tx);
|
||||
|
||||
if (this.debugFill)
|
||||
{
|
||||
this.context.fillRect(this._tx, this._ty, this.tileWidth, this.tileHeight);
|
||||
this.context.fillRect(this._tx, this._ty, set.tileWidth, set.tileHeight);
|
||||
}
|
||||
|
||||
this.context.beginPath();
|
||||
@@ -935,36 +850,36 @@ Phaser.TilemapLayer.prototype.renderDebug = function () {
|
||||
if (tile.faceTop)
|
||||
{
|
||||
this.context.moveTo(this._tx, this._ty);
|
||||
this.context.lineTo(this._tx + this.tileWidth, this._ty);
|
||||
this.context.lineTo(this._tx + set.tileWidth, this._ty);
|
||||
}
|
||||
|
||||
if (tile.faceBottom)
|
||||
{
|
||||
this.context.moveTo(this._tx, this._ty + this.tileHeight);
|
||||
this.context.lineTo(this._tx + this.tileWidth, this._ty + this.tileHeight);
|
||||
this.context.moveTo(this._tx, this._ty + set.tileHeight);
|
||||
this.context.lineTo(this._tx + set.tileWidth, this._ty + set.tileHeight);
|
||||
}
|
||||
|
||||
if (tile.faceLeft)
|
||||
{
|
||||
this.context.moveTo(this._tx, this._ty);
|
||||
this.context.lineTo(this._tx, this._ty + this.tileHeight);
|
||||
this.context.lineTo(this._tx, this._ty + set.tileHeight);
|
||||
}
|
||||
|
||||
if (tile.faceRight)
|
||||
{
|
||||
this.context.moveTo(this._tx + this.tileWidth, this._ty);
|
||||
this.context.lineTo(this._tx + this.tileWidth, this._ty + this.tileHeight);
|
||||
this.context.moveTo(this._tx + set.tileWidth, this._ty);
|
||||
this.context.lineTo(this._tx + set.tileWidth, this._ty + set.tileHeight);
|
||||
}
|
||||
|
||||
this.context.stroke();
|
||||
}
|
||||
|
||||
this._tx += this.tileWidth;
|
||||
this._tx += this.map.tileWidth;
|
||||
|
||||
}
|
||||
|
||||
this._tx = this._dx;
|
||||
this._ty += this.tileHeight;
|
||||
this._ty += this.map.tileHeight;
|
||||
|
||||
}
|
||||
|
||||
@@ -976,9 +891,9 @@ Phaser.TilemapLayer.prototype.renderDebug = function () {
|
||||
* @memberof Phaser.TilemapLayer
|
||||
* @return {number} Absolute delta X value
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.deltaAbsX = function () {
|
||||
return (this.deltaX() > 0 ? this.deltaX() : -this.deltaX());
|
||||
}
|
||||
// Phaser.TilemapLayer.prototype.deltaAbsX = function () {
|
||||
// return (this.deltaX() > 0 ? this.deltaX() : -this.deltaX());
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns the absolute delta y value.
|
||||
@@ -986,9 +901,9 @@ Phaser.TilemapLayer.prototype.deltaAbsX = function () {
|
||||
* @memberof Phaser.TilemapLayer
|
||||
* @return {number} Absolute delta Y value
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.deltaAbsY = function () {
|
||||
return (this.deltaY() > 0 ? this.deltaY() : -this.deltaY());
|
||||
}
|
||||
// Phaser.TilemapLayer.prototype.deltaAbsY = function () {
|
||||
// return (this.deltaY() > 0 ? this.deltaY() : -this.deltaY());
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns the delta x value.
|
||||
@@ -996,9 +911,9 @@ Phaser.TilemapLayer.prototype.deltaAbsY = function () {
|
||||
* @memberof Phaser.TilemapLayer
|
||||
* @return {number} Delta X value
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.deltaX = function () {
|
||||
return this._dx - this._prevX;
|
||||
}
|
||||
// Phaser.TilemapLayer.prototype.deltaX = function () {
|
||||
// return this._dx - this._prevX;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns the delta y value.
|
||||
@@ -1006,9 +921,9 @@ Phaser.TilemapLayer.prototype.deltaX = function () {
|
||||
* @memberof Phaser.TilemapLayer
|
||||
* @return {number} Delta Y value
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.deltaY = function () {
|
||||
return this._dy - this._prevY;
|
||||
}
|
||||
// Phaser.TilemapLayer.prototype.deltaY = function () {
|
||||
// return this._dy - this._prevY;
|
||||
// }
|
||||
|
||||
/**
|
||||
* @name Phaser.TilemapLayer#scrollX
|
||||
@@ -1022,16 +937,17 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollX", {
|
||||
|
||||
set: function (value) {
|
||||
|
||||
if (value !== this._x && value >= 0 && this.layer && this.widthInPixels > this.renderWidth)
|
||||
// if (value !== this._x && value >= 0 && this.layer && this.layer.widthInPixels > this.width)
|
||||
if (value !== this._x && value >= 0 && this.layer.widthInPixels > this.width)
|
||||
{
|
||||
this._x = value;
|
||||
|
||||
if (this._x > (this.widthInPixels - this.renderWidth))
|
||||
if (this._x > (this.layer.widthInPixels - this.width))
|
||||
{
|
||||
this._x = this.widthInPixels - this.renderWidth;
|
||||
this._x = this.layer.widthInPixels - this.width;
|
||||
}
|
||||
|
||||
this._startX = this.game.math.floor(this._x / this.tileWidth);
|
||||
this._startX = this.game.math.floor(this._x / this.map.tileWidth);
|
||||
|
||||
if (this._startX < 0)
|
||||
{
|
||||
@@ -1062,16 +978,17 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollY", {
|
||||
|
||||
set: function (value) {
|
||||
|
||||
if (value !== this._y && value >= 0 && this.layer && this.heightInPixels > this.renderHeight)
|
||||
// if (value !== this._y && value >= 0 && this.layer && this.heightInPixels > this.renderHeight)
|
||||
if (value !== this._y && value >= 0 && this.layer.heightInPixels > this.height)
|
||||
{
|
||||
this._y = value;
|
||||
|
||||
if (this._y > (this.heightInPixels - this.renderHeight))
|
||||
if (this._y > (this.layer.heightInPixels - this.height))
|
||||
{
|
||||
this._y = this.heightInPixels - this.renderHeight;
|
||||
this._y = this.layer.heightInPixels - this.height;
|
||||
}
|
||||
|
||||
this._startY = this.game.math.floor(this._y / this.tileHeight);
|
||||
this._startY = this.game.math.floor(this._y / this.map.tileHeight);
|
||||
|
||||
if (this._startY < 0)
|
||||
{
|
||||
|
||||
@@ -141,9 +141,25 @@ Phaser.TilemapParser = {
|
||||
*/
|
||||
parseTiledJSON: function (json) {
|
||||
|
||||
// Map data will consist of: layers, objects, images, tilesets
|
||||
if (json.orientation !== 'orthogonal')
|
||||
{
|
||||
console.warn('TilemapParser.parseTiledJSON: Only orthogonal map types are supported in this version of Phaser');
|
||||
return null;
|
||||
}
|
||||
|
||||
// Map data will consist of: layers, objects, images, tilesets, sizes
|
||||
var map = {};
|
||||
|
||||
map.width = json.width;
|
||||
map.height = json.height;
|
||||
map.tileWidth = json.tilewidth;
|
||||
map.tileHeight = json.tileheight;
|
||||
map.orientation = json.orientation;
|
||||
map.version = json.version;
|
||||
map.properties = json.properties;
|
||||
map.widthInPixels = map.width * map.tileWidth;
|
||||
map.heightInPixels = map.height * map.tileHeight;
|
||||
|
||||
// Tile Layers
|
||||
var layers = [];
|
||||
|
||||
@@ -161,13 +177,12 @@ Phaser.TilemapParser = {
|
||||
y: json.layers[i].y,
|
||||
width: json.layers[i].width,
|
||||
height: json.layers[i].height,
|
||||
widthInPixels: json.layers[i].width * json.tilewidth,
|
||||
heightInPixels: json.layers[i].height * json.tileheight,
|
||||
alpha: json.layers[i].opacity,
|
||||
visible: json.layers[i].visible,
|
||||
properties: {},
|
||||
tileWidth: json.tilewidth,
|
||||
tileHeight: json.tileheight,
|
||||
|
||||
indexes: [],
|
||||
indexes: []
|
||||
|
||||
};
|
||||
|
||||
@@ -286,71 +301,6 @@ Phaser.TilemapParser = {
|
||||
// Tilesets
|
||||
var tilesets = [];
|
||||
|
||||
|
||||
/*
|
||||
// for (var i = this.firstgid; i < this.firstgid + this.total; i++)
|
||||
for (var i = 0; i < this.total; i++)
|
||||
{
|
||||
// Can add extra properties here as needed
|
||||
this.tiles[i] = [x, y];
|
||||
|
||||
x += this.tileWidth + this.tileSpacing;
|
||||
|
||||
count++;
|
||||
|
||||
if (count === this.total)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
countX++;
|
||||
|
||||
if (countX === this.rows)
|
||||
{
|
||||
x = this.tileMargin;
|
||||
y += this.tileHeight + this.tileSpacing;
|
||||
|
||||
countX = 0;
|
||||
countY++;
|
||||
|
||||
if (countY === this.columns)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
{
|
||||
"firstgid":1,
|
||||
"image":"ground_1x1.png",
|
||||
"imageheight":32,
|
||||
"imagewidth":800,
|
||||
"margin":0,
|
||||
"name":"ground_1x1",
|
||||
"properties":
|
||||
{
|
||||
|
||||
},
|
||||
"spacing":0,
|
||||
"tileheight":32,
|
||||
"tileproperties":
|
||||
{
|
||||
"1":
|
||||
{
|
||||
"bounce":"1"
|
||||
}
|
||||
},
|
||||
"tilewidth":32
|
||||
},
|
||||
|
||||
|
||||
Create 1 Tileset object that contains the above, but NOT the actual tile indexes
|
||||
Put the tile indexes into a global array (tiles?) - just need x,y + img - a drawImage look-up table
|
||||
|
||||
*/
|
||||
|
||||
for (var i = 0; i < json.tilesets.length; i++)
|
||||
{
|
||||
// name, firstgid, width, height, margin, spacing, properties
|
||||
@@ -362,21 +312,63 @@ Phaser.TilemapParser = {
|
||||
newSet.tileProperties = set.tileproperties;
|
||||
}
|
||||
|
||||
// rows, columns, total
|
||||
var rows = set.imageheight / set.tileheight;
|
||||
var columns = set.imagewidth / set.tilewidth;
|
||||
var total = rows * columns;
|
||||
|
||||
newSet.rows = rows;
|
||||
newSet.columns = columns;
|
||||
newSet.total = total;
|
||||
newSet.rows = set.imageheight / set.tileheight;
|
||||
newSet.columns = set.imagewidth / set.tilewidth;
|
||||
newSet.total = newSet.rows * newSet.columns;
|
||||
|
||||
tilesets.push(newSet);
|
||||
}
|
||||
|
||||
map.tilesets = tilesets;
|
||||
|
||||
map.tiles = [];
|
||||
|
||||
// Finally lets build our super tileset index
|
||||
for (var i = 0; i < map.tilesets.length; i++)
|
||||
{
|
||||
var set = map.tilesets[i];
|
||||
|
||||
var x = set.tileMargin;
|
||||
var y = set.tileMargin;
|
||||
|
||||
var count = 0;
|
||||
var countX = 0;
|
||||
var countY = 0;
|
||||
|
||||
for (var t = set.firstgid; t < set.firstgid + set.total; t++)
|
||||
{
|
||||
// Can add extra properties here as needed
|
||||
map.tiles[t] = [x, y, i];
|
||||
|
||||
x += set.tileWidth + set.tileSpacing;
|
||||
|
||||
count++;
|
||||
|
||||
if (count === set.total)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
countX++;
|
||||
|
||||
if (countX === set.columns)
|
||||
{
|
||||
x = set.tileMargin;
|
||||
y += set.tileHeight + set.tileSpacing;
|
||||
|
||||
countX = 0;
|
||||
countY++;
|
||||
|
||||
if (countY === set.rows)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Lets build our super tileset index
|
||||
map.tilesets = tilesets;
|
||||
console.log(map);
|
||||
|
||||
return map;
|
||||
|
||||
|
||||
+6
-146
@@ -11,13 +11,12 @@
|
||||
* @class Phaser.Tileset
|
||||
* @constructor
|
||||
* @param {string} name - The name of the tileset in the map data.
|
||||
* @param {number} tileWidth - Width of each tile in pixels.
|
||||
* @param {number} tileHeight - Height of each tile in pixels.
|
||||
* @param {number} tileMargin - The amount of margin around the tilesheet.
|
||||
* @param {number} tileSpacing - The amount of spacing between each tile in the sheet.
|
||||
* @param {number} rows - How many tiles are placed horizontally in each row.
|
||||
* @param {number} columns - How many tiles are placed vertically in each column.
|
||||
* @param {number} total - The maximum number of tiles to extract from the image.
|
||||
* @param {number} firstgid - The Tiled firstgid value.
|
||||
* @param {number} width - Width of each tile in pixels.
|
||||
* @param {number} height - Height of each tile in pixels.
|
||||
* @param {number} margin - The amount of margin around the tilesheet.
|
||||
* @param {number} spacing - The amount of spacing between each tile in the sheet.
|
||||
* @param {object} properties - Tileset properties.
|
||||
*/
|
||||
Phaser.Tileset = function (name, firstgid, width, height, margin, spacing, properties) {
|
||||
|
||||
@@ -62,11 +61,6 @@ Phaser.Tileset = function (name, firstgid, width, height, margin, spacing, prope
|
||||
*/
|
||||
this.tileProperties = {};
|
||||
|
||||
/**
|
||||
* @property {string} key - The cache ID.
|
||||
*/
|
||||
// this.key = key;
|
||||
|
||||
/**
|
||||
* @property {object} image - The image used for rendering.
|
||||
*/
|
||||
@@ -87,71 +81,10 @@ Phaser.Tileset = function (name, firstgid, width, height, margin, spacing, prope
|
||||
*/
|
||||
this.total = 0;
|
||||
|
||||
/**
|
||||
* @property {array} tiles - An array of the tile data.
|
||||
*/
|
||||
// this.tiles = [];
|
||||
|
||||
// this.build();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Phaser.Tileset.prototype = {
|
||||
|
||||
/**
|
||||
* Builds the tileset data.
|
||||
*
|
||||
* @method Phaser.Tileset#build
|
||||
*/
|
||||
build: function () {
|
||||
|
||||
var x = this.tileMargin;
|
||||
var y = this.tileMargin;
|
||||
|
||||
var count = 0;
|
||||
var countX = 0;
|
||||
var countY = 0;
|
||||
|
||||
console.log('Building tileset', this.rows, 'x', this.columns, 'total', this.total);
|
||||
|
||||
// for (var i = this.firstgid; i < this.firstgid + this.total; i++)
|
||||
for (var i = 0; i < this.total; i++)
|
||||
{
|
||||
// Can add extra properties here as needed
|
||||
this.tiles[i] = [x, y];
|
||||
|
||||
x += this.tileWidth + this.tileSpacing;
|
||||
|
||||
count++;
|
||||
|
||||
if (count === this.total)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
countX++;
|
||||
|
||||
if (countX === this.rows)
|
||||
{
|
||||
x = this.tileMargin;
|
||||
y += this.tileHeight + this.tileSpacing;
|
||||
|
||||
countX = 0;
|
||||
countY++;
|
||||
|
||||
if (countY === this.columns)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.table(this.tiles);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets a Tile from this set.
|
||||
*
|
||||
@@ -205,24 +138,6 @@ Phaser.Tileset.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if the tile at the given index can collide.
|
||||
*
|
||||
* @method Phaser.Tileset#canCollide
|
||||
* @param {number} index - The index of the tile within the set.
|
||||
* @return {boolean} True or false depending on the tile collision or null if no tile was found at the given index.
|
||||
canCollide: function (index) {
|
||||
|
||||
if (this.tiles[index])
|
||||
{
|
||||
return this.tiles[index].collideNone;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
},
|
||||
*/
|
||||
|
||||
/**
|
||||
* Checks if the tile at the given index exists.
|
||||
*
|
||||
@@ -234,61 +149,6 @@ Phaser.Tileset.prototype = {
|
||||
|
||||
return (this.tiles[index]);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets collision values on a range of tiles in the set.
|
||||
*
|
||||
* @method Phaser.Tileset#setCollisionRange
|
||||
* @param {number} start - The index to start setting the collision data on.
|
||||
* @param {number} stop - The index to stop setting the collision data on.
|
||||
* @param {boolean} left - Should the tile collide on the left?
|
||||
* @param {boolean} right - Should the tile collide on the right?
|
||||
* @param {boolean} up - Should the tile collide on the top?
|
||||
* @param {boolean} down - Should the tile collide on the bottom?
|
||||
setCollisionRange: function (start, stop, left, right, up, down) {
|
||||
|
||||
if (this.tiles[start] && this.tiles[stop] && start < stop)
|
||||
{
|
||||
for (var i = start; i <= stop; i++)
|
||||
{
|
||||
this.tiles[i].setCollision(left, right, up, down);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets collision values on a tile in the set.
|
||||
*
|
||||
* @method Phaser.Tileset#setCollision
|
||||
* @param {number} index - The index of the tile within the set.
|
||||
* @param {boolean} left - Should the tile collide on the left?
|
||||
* @param {boolean} right - Should the tile collide on the right?
|
||||
* @param {boolean} up - Should the tile collide on the top?
|
||||
* @param {boolean} down - Should the tile collide on the bottom?
|
||||
setCollision: function (index, left, right, up, down) {
|
||||
|
||||
if (this.tiles[index])
|
||||
{
|
||||
this.tiles[index].setCollision(left, right, up, down);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Phaser.Tileset#total
|
||||
* @property {number} total - The total number of tiles in this Tileset.
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Tileset.prototype, "XXXtotal", {
|
||||
|
||||
get: function () {
|
||||
return this.tiles.length;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user