Secretmapper Posted February 19, 2014 Share Posted February 19, 2014 Look at this: The other 'guy' is behind the tower, even if his y is more than the tower. var watcher = this.game.add.group(); watcher.x = 30; watcher.y = 120; watcher.create(0, 0, 'sheet', 'Watch-red'); watcher.getAt(0).anchor.setTo(0.5, 1); board.add(watcher); var towers = this.game.add.group(); var tower = towers.create(0, 0, 'sheet', 'WatchTower'); tower.anchor.setTo(0, 1); towers.y = 112; board.add(towers); console.log(watcher.y, towers.y); //120, 112then in my update function: board.sort(); // also tried, board.sort('y', Phaser.Group.SORT_DESCENDING); and ASCENDING, both do image aboveWhy doesn't it work? is it because it is not possible to sort groups themselves? Link to comment Share on other sites More sharing options...
rich Posted February 19, 2014 Share Posted February 19, 2014 Yes this is a limitation of 1.1 I'm afraid (Group.sort doesn't sort child groups correctly). Thankfully gone in Phaser v2, but sadly still an annoying issue for now Link to comment Share on other sites More sharing options...
Secretmapper Posted February 20, 2014 Author Share Posted February 20, 2014 Thanks @rich! Link to comment Share on other sites More sharing options...
Recommended Posts