Jump to content

Tween Collision


xyruleib
 Share

Recommended Posts

I'm moving the character through tween, because I want to move it tile by tile.

But with so I am unable to do collide with coins.

I would like to make when it passes on a tile that has coin, the coin is caught (coin.kill(); addScore();).

Link to comment
Share on other sites

Even if an element is moving on a tween, normal overlap checks done in the update method should still work. In your state:

update: function() {  //assuming this.coins is a group with all the coins  this.game.physics.arcade.overlap(this.player, this.coins, this.grabCoin, null, this);},grabCoin: function(player, coin) {  coin.kill();  this.addScore();}
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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