Skip to content

Disable Collision for Player #2728

Answered by eonarheim
cemalgnlts asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @cemalgnlts! Great question!

I'd definitely use a collision group to make this happen. If the player and the bomb are in the same collision group they won't interact.

There is some additional documentation on collision groups here: https://excaliburjs.com/docs/api/edge/classes/CollisionGroup.html

const playerGroup = ex.CollisionGroupManager.create('player');
const player = new ex.Actor({
  ...
  collisionGroup: playerGroup
});

// drop bomb code
const bomb = new ex.Actor({
  ...
  collisionGroup: playerGroup
});

You can add a collision group to a tile map by retrieving it's body component and setting the group property. Apologies TileMap's don't have the same convenient way as Actors t…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@eonarheim
Comment options

Answer selected by cemalgnlts
@cemalgnlts
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants