druphoria Posted November 14, 2014 Share Posted November 14, 2014 I think there may be an issue with the checkWorldBounds logic in Phaser.Sprite.prototype.preUpdate, specifically the part where the game world bounds intersection is checked against the sprite bounds:if (this._cache[5] === 1 && this.game.world.bounds.intersects(this._bounds)) { this._cache[5] = 0; this.events.onEnterBounds.dispatch(this); } else if (this._cache[5] === 0 && !this.game.world.bounds.intersects(this._bounds)) { // The Sprite WAS in the screen, but has now left. this._cache[5] = 1; this.events.onOutOfBounds.dispatch(this); if (this.outOfBoundsKill) { this.kill(); return false; } }I noticed that my sprite was falling for a good while after falling past the bottom edge of the map before the onOutOfBounds event was dispatched, the result being that it takes way too long for my killPlayer function to be executed. I believe that the "this._bounds" being checked in the code snippet above, which is calculated using Pixi.Sprite's getBounds() method, uses some kind of coordinate system that is localized to the visible game window (I realized this by checking sprite.getBounds() while moving my sprite around the screen). Because my map is taller than the height of my game, my sprite has to fall for that difference in height before the game registers it as being out of place. Just wondering if this is the intended behavior, or if I am simply misunderstanding something here. Link to comment Share on other sites More sharing options...
druphoria Posted November 15, 2014 Author Share Posted November 15, 2014 Has anyone run into issues with this when using a tilemap that is taller than the game? Link to comment Share on other sites More sharing options...
Recommended Posts