Jump to content

Destroying coins in collision


Ryan Makinano
 Share

Recommended Posts

Hi guys! I am newbie to phaser and i would like to ask question and guide me in my project. I am currently developing a game for my project. My game will collect coins and coins that have question to be answered and will be evaluated if the user can play next level. 

Im using Tiled. And i am having trouble when the collision on the coins it increase the score multiple times before it will gone. Here is my code. Hope you guys help me.

    getCoin:function(){

        
        map.putTile(-1,layer.getTileX(player.x), layer.getTileY(player.y));
        score += 10;
           scoreText.text = 'Score: ' + score;
        
    }

It replaces the tile with a tile that didnt exist so i appears to be gone.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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