lrodriguez Posted June 21, 2014 Share Posted June 21, 2014 hi, as "detect" the collision of a sprite with the edges of my canvas ? Link to comment Share on other sites More sharing options...
lewster32 Posted June 21, 2014 Share Posted June 21, 2014 Use four sprites placed just outside of your world to create 'walls' around your game, and collide against those. Link to comment Share on other sites More sharing options...
Kobaltic Posted June 21, 2014 Share Posted June 21, 2014 Edit: ignore post. I misread what you wanted follow advice from lewster32 Link to comment Share on other sites More sharing options...
lewster32 Posted June 21, 2014 Share Posted June 21, 2014 Yeah I wasn't sure if he just wanted to collide against them but world collisions don't generate events afaik. Using walls allows you to detect those and also which wall they've collided against. Link to comment Share on other sites More sharing options...
lrodriguez Posted June 21, 2014 Author Share Posted June 21, 2014 Thanks for your answers, I thought I had a role in phaser that permitted me to do this, but I see no, what I've done is the following function verificarColisionWorld() { var alto = innerHeight; if (miestrella.y > alto - 40) { miestrella.destroy(); } if (midiamante.y > alto - 40) { midiamante.destroy(); }} Link to comment Share on other sites More sharing options...
lewster32 Posted June 21, 2014 Share Posted June 21, 2014 Oh I see, in that case yes, Phaser does have this functionality: http://docs.phaser.io/Phaser.Sprite.html#outOfBoundsKill though your method will give you much better performance as it's more specific. Link to comment Share on other sites More sharing options...
lrodriguez Posted June 22, 2014 Author Share Posted June 22, 2014 Muchas gracias por su ayuda !! Link to comment Share on other sites More sharing options...
Recommended Posts