Teemu-Tor Posted March 24, 2014 Share Posted March 24, 2014 I seem to have some problems with outOfBounds event. Everything worked fine on 1.x version, but not on 2.0. code: poop.events.onOutOfBounds.add(this.poopOut, poop); poopOut: function(poop) {console.log('out');} What am I doing wrong? Link to comment Share on other sites More sharing options...
Luis Felipe Posted March 24, 2014 Share Posted March 24, 2014 Have a look at the migration guide: https://github.com/photonstorm/phaser/blob/master/resources/Migration%20Guide.md under"Changes to Phaser.Sprite". This might be the answer. Hope it helps Link to comment Share on other sites More sharing options...
Teemu-Tor Posted March 25, 2014 Author Share Posted March 25, 2014 Luis Felipe: Thanks for the pointer! I found the answer to my question under:Changes to Phaser.SpriteBy default Sprites no longer check if they are within the world bounds. It's quite an expensive process (calling getBounds every frame), so you have to enable directly.Now it works Luis Felipe 1 Link to comment Share on other sites More sharing options...
Harissa Posted July 8, 2014 Share Posted July 8, 2014 There's an example showing this here http://examples.phaser.io/_site/view_full.html?d=sprites&f=out+of+bounds.js&t=out%20of%20bounds and here's a fragment from my code (in Typescript)this.checkWorldBounds = true;this.events.onOutOfBounds.add(this.hitEdge,this); hitEdge(robot:Robot) { console.log("hit the edge of the world");} Link to comment Share on other sites More sharing options...
Recommended Posts