Jump to content

Ghost sprite with collision detection


breverie
 Share

Recommended Posts

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 this

game.add.sprite(0, 0, null);
Link to comment
Share on other sites

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.)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...