breverie Posted December 5, 2014 Share Posted December 5, 2014 Hello,I want to have a "ghost" sprite that can tell me when there is a collision with it, yet it won't be affected physically from the collision.How can I do that? Thanks in advance Link to comment Share on other sites More sharing options...
shmikucis Posted December 7, 2014 Share Posted December 7, 2014 You can check if both sprites intersects Phaser.Rectangle.intersects(boundsA, boundsB);I've made an example which writes in to console whenever both sprites intersects. Here is project with code (Source Editor -> play.js) If I've understood you correctly then ghost sprite is a sprite without texture and can be created like thisgame.add.sprite(0, 0, null); Link to comment Share on other sites More sharing options...
jpdev Posted December 7, 2014 Share Posted December 7, 2014 When you want information about overlaps, but not have physical interaction you can always use "arcade.phsysics.overlap(obj1, obj2, callback)" instead of "arcade.physics.collide". This way the callback is fired, but there is no interaction. This assumes you use the arcade engine. (For p2-physics, have a look into sensors -> setting sensor = true on the shapes should have the desired effect.) satanas 1 Link to comment Share on other sites More sharing options...
Recommended Posts