Lots of Tilemap updates, moved the renderer out, added components and new tests.

This commit is contained in:
Richard Davey
2013-07-02 23:41:25 +01:00
parent c647792c12
commit c81cf0c882
34 changed files with 2395 additions and 1563 deletions
+45 -1
View File
@@ -618,17 +618,58 @@ module Phaser {
public bringToTop(child): bool {
//console.log('bringToTop', child.name,'current z', child.z);
var oldZ = child.z;
// If child not in this group, or is already at the top of the group, return false
if (!child || child.group == null || child.group.ID != this.ID || child.z == this._zCounter)
//if (!child || child.group == null || child.group.ID != this.ID || child.z == this._zCounter)
if (!child || child.group == null || child.group.ID != this.ID)
{
//console.log('If child not in this group, or is already at the top of the group, return false');
return false;
}
// Find out the largest z index
var topZ: number = -1;
for (var i = 0; i < this.length; i++)
{
if (this.members[i] && this.members[i].z > topZ)
{
topZ = this.members[i].z;
}
}
// Child is already at the top
if (child.z == topZ)
{
return false;
}
child.z = topZ + 1;
// Sort them out based on the current z indexes
this.sort();
// Now tidy-up the z indexes, removing gaps, etc
for (var i = 0; i < this.length; i++)
{
if (this.members[i])
{
this.members[i].z = i;
}
}
//console.log('bringToTop', child.name, 'old z', oldZ, 'new z', child.z);
return true;
// What's the z index of the top most child?
/*
var childIndex: number = this._zCounter;
console.log('childIndex', childIndex);
this._i = 0;
while (this._i < this.length)
@@ -649,10 +690,13 @@ module Phaser {
}
}
console.log('child inserted at index', child.z);
// Maybe redundant?
this.sort();
return true;
*/
}