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...

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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