TMichel Posted August 25, 2014 Share Posted August 25, 2014 Hi, I was wondering which one would be. I have set the game's viewport to 800x600 and the world bounds to 2048x1024. The player moves and the camera follows it. I want to dynamically load the tiles that are in the bounds of the viewport while the player moves around and kill the ones that are out. I was naively trying to kill() onOutOfBounds and then revive() onEnterBounds. Did not work but i don't know why. Apparently behind scenes is doing:!this.game.world.bounds.intersects(this._bounds)So i tried to replicate the functionality building an array of the killed tiles onOutOfBounds and, on the update() method, iterate over the killed tiles to check the intersect:if( game.world.bounds.intersects(killedTiles[i]._bounds) ){ killedTiles[i].revive();}The conditional is always false (?) and the ammount of process seems like an overkill for me (for big maps). Anyway i am using isometric phaser plugin if that makes any difference (i tried also with killedTiles._isoBounds). Someone has any tips? Link to comment Share on other sites More sharing options...
lewster32 Posted August 25, 2014 Share Posted August 25, 2014 I'll have to look into this, but for this kind of sized map I think killing and reviving sprites is somewhat overkill. The default behaviour is to set the visible property to false on objects outside of the camera, which prevents them being rendered. The Isometric plug-in should not alter the behaviour of camera culling as IsoSprites still retain their 2D bounding info, and I believe I have tested to ensure this works as expected. There's still some work to be done on the sort routines so they only sort visible IsoSprites, and in many cases performance can probably be improved hugely. In the mean time, if you have any specific issues related to the Isometric plug-in by all means post them on the Github page along with as much detail as you can provide, and I'll make sure to take a look: https://github.com/lewster32/phaser-plugin-isometric Link to comment Share on other sites More sharing options...
Recommended Posts