0 Favourites

How do I restore destroyed objects? (CAPX Included)

  • Hey guys! I'm working on a project and i need some help please.. <img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes">

    I use touch to destroy 1 object each time. Now i want, when i press "restore" button to restore the latest object.

    Is this too difficult??? <img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question">

    Here is the capx, hope to find a solution someone:

    https://www.dropbox.com/s/urlq58ujldev0 ... jects.capx

    Thanks again guys!!! <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

  • I assume that when an instance is destroyed there is no information kept on it's last location and such. But you have several options I can think of of the top of my head:

    Instead of destroying the instance move it off screen or turn it invisible

    Respawn an instance of the object

    If the instance won't always be in the same location then you could use the 'on instance destroyed' to store location or other information in global variables or array.

    If all objects need to get restored you can simply use 'restart layout'

    In short I don't believe there is any event that you can set this up in one step but you have plenty of tools at your disposal to achieve what you desire.

  • I though there is a way to read the object, a tip, you know. In my example i need to read with some way, what frame was, what position maybe and after destroy to create a new object.

    I don't need to restore exactly the same object, just a clone but with same details.

    Example: Last object was a red item with X: 100 and Y: 200. So i need to restore the same object not just the sprite again with a random frame (more details inside capx).

    Another example is to have different sprites, not 1 sprite with different frames. So in this way to restore exactly the sprites.

    In words it's more easy, i know..

    I need to restore each object not everything, so i don' need something like "restart layout".

    Maybe "invisible" it's a good option.. Thanks for your answer! ; -)

  • Yeah, in short, I don't think destroying it is the smart choice if you want to retain that much information about it

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Ok, thanks again! ; -)

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