Instance deletion - by user

0 favourites
  • 6 posts
From the Asset Store
High quality user interface sound effects for Sci-Fi projects
  • Okay, long story short, I am creating a dress up game. For reasons. And so far, I have it set up that the user can go to the menu, and click on the thumbnail for an accessory which will spawn onto the layout as a drag and drop behavior object. The user has many to choose from, and can spawn more than one of that object.

    My question: I want the user to be able to delete any of the instances that they desire. Maybe by clicking on it and then clicking a delete button? However, I don't want the button click to delete ALL instances of that object--just the desired one.

    How would I go about doing this?

    Thank you in advanced.

  • add an id to the instances as instance variable, also add a global variable ID, set the global one to 1 and the instance one to 0. When the player selects the dress set the global value to the instance variable value, then add event to check if object.ID == Global.ID and button1 pressed then as action destroy object.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • add an id to the instances as instance variable, also add a global variable ID, set the global one to 1 and the instance one to 0. When the player selects the dress set the global value to the instance variable value, then add event to check if object.ID == Global.ID and button1 pressed then as action destroy object.

    SUPER helpful answer. I think I'm just being dumb, and am sure that I am doing something wrong; because it's deleting all the instances of that object. Do you have a quick example?

  • Here I made an example, left click the image to select then click the delete button to delete the selected instance.

    https://www.dropbox.com/s/1fxllo6elggld ... .capx?dl=0

  • Here I made an example, left click the image to select then click the delete button to delete the selected instance.

    https://www.dropbox.com/s/1fxllo6elggld ... .capx?dl=0

    Ah-ha! I was trying to pull the wrong variable. I found my problem and have it working. Thank you so much. <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    Your example proved to be most helpful.

  • Glad to help, good luck with your game

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)