How do I respawn instances of an object?

0 favourites
  • 6 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • So saying I have a "Troll" sprite and created few instances of it. Now I need to respawn them every time my player kills them.

    But this isn't working. I try to do it with pick by IID. But it only works for one instance. Then I tried creating new spawn sprites for other troll instances and repeat the On Destroyed event but that doesnt work as well. I tried to add another event/sub event pick by unique UID of troll instances but failed.

    Im a beginner so I havent got yet to the point to understand UID/IDD very well and if they change on destroy/respawn.

    I also tried it without a respawn sprite. And it works ok. But it respawns them instantly, which I dont want it. I added the time behavior to troll but then doesnt respawn at all.

    Any help is greatly appreciated.

    Thanks in advance.

  • Because the sprite which you want to get the IID/UID was destroyed.

    Construct can't find it anymore.

    You can set the layer number directly or store the layer number of your Troll right before it destroyed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Im sorry Im afraid I dont understand you. Could you please write a simple example.

  • Why instead of having 2 a second condition "On destroyed" just create a sub action inside the main one: If Health <= 0

    • Destroy
    • Start Timer
  • Simplify is the spawn object cannot find your Troll.IID after it destroyed

    You will need to replace it with your certain layer number.

  • A simpler method might be to simply turn the troll invisible and disable his movement and logic. He will appear "destroyed" and "respawned" but really you're just hiding and later re-enabling him (allowing him to retain his UID)

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