Jump to content

Destroy/ Kill Sprite


Get_Bentley
 Share

Recommended Posts

Hey All,

 

Last night decided to give Phaser 3 Beta a whirl, so far has been an interesting journey trying to figure everything out. 

 

So basically my question here is I cannot seem to destroy/kill a sprite, basically what I am doing in a very simple form is testing the new functionality and making a sprite interactive and what I want is to have to sprite destroyed/killed on a click (simple I know), but for the life of me after going through the examples I do not see a way to do this. I know it is probably right in front of my nose but if someone could help me out or point me in the right direction I would greatly appreciate it! 

 

Right after posting this I have found this functionality but am not quite sure if it the correct way to destroy/kill a sprite. Let me know if anyone has any opinions or guidance.

 

this.input.events.on('POINTER_DOWN_EVENT', function (event) {

            event.gameObject.setActive(false);
            event.gameObject.setVisible(false);
        });

 

Thank you all!

Link to comment
Share on other sites

  • 2 weeks later...
 Share

  • Recently Browsing   0 members

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