Jump to content

Ghost sprite with collision detection


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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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