mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 12:43:26 +00:00
commit
a127080794
1 changed files with 27 additions and 0 deletions
|
@ -883,6 +883,28 @@ Phaser.Tilemap.prototype = {
|
|||
|
||||
},
|
||||
|
||||
/**
|
||||
* Turn off/on the recalculation of faces for tile or collission updates.
|
||||
* setPreventRecalculate(true) puts recalculation on hold while
|
||||
* setPreventRecalculate(false) recalculates all the changed layers.
|
||||
*
|
||||
* @method Phaser.Tilemap#setPreventRecalculate
|
||||
* @param {boolean} if true it will put the recalculation on hold.
|
||||
*/
|
||||
setPreventRecalculate: function (value) {
|
||||
if((value===true)&&(this.preventingRecalculate!==true)){
|
||||
this.preventingRecalculate = true;
|
||||
this.needToRecalculate = {};
|
||||
}
|
||||
if((value===false)&&(this.preventingRecalculate===true)){
|
||||
this.preventingRecalculate = false;
|
||||
for(var i in this.needToRecalculate){
|
||||
this.calculateFaces(i);
|
||||
}
|
||||
this.needToRecalculate = false;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Internal function.
|
||||
*
|
||||
|
@ -892,6 +914,11 @@ Phaser.Tilemap.prototype = {
|
|||
*/
|
||||
calculateFaces: function (layer) {
|
||||
|
||||
if(this.preventingRecalculate===true){
|
||||
this.needToRecalculate[layer] = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var above = null;
|
||||
var below = null;
|
||||
var left = null;
|
||||
|
|
Loading…
Reference in a new issue