[How to respawn after last instance is destroyed?

0 favourites
  • 7 posts
From the Asset Store
Show your master of martial arts by killing all flies empty handedly!!!
  • <font face="Arial, Helvetica, sans-serif">


    I'm creating a catapult game where a single instance projectile is present on the start of the layout.

    When the catapult is touched the projectile would be positioned to the catapult.

    The projectile is destroyed when it hits an enemy. When the catapult is clicked, the projectile would re-spawn on the catapult as long as another projectile as long as there is an instance of the projectile somewhere on the screen.


    How to spawn the same projectile after destroying the projectile's last instance.

    SORRY for my english. Thanks :)


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • An instance of the object has to be present on the layout on start.

    you could use:

    on start of layout - system destroy object

    After that you will be able to spawn and create it.

  • Yes the object is on the layout but my catapult doesn't work like the bullet example in Construct 2 where spawn is used for firing the bullets.

    My project has the single instance of the projectile object reposition itself on the catapult once the catapult is clicked, and when thrown, the object would then be destroyed if it collides with an enemy.

    This means that there is no instance left once the object is destoyed. I was wondering if it is possible to spawn another instance even if this is so.

    I'm using the catapult template of construct 2 btw.

  • Yes, it's possible, as long as there has been an instance on the layout.

    Just use system create object.

  • Hi majikk

    From your description I suspect that you are asking the projectile to respawn itself ;-) - and so it can only work if the projectile exists somewhere in the current scene.

    You can get any other object to spawn the projectile for you - e.g. catapult -> Spawn another object, or use sytem->create object as suggested above.



  • LittleStain It tried your suggestion and for it to work, at least a single instance of the object is needed to be present somewhere on the layout. Thanks anyways :)

    CJK Thank you I tried this and it worked. :)

  • majikk

    My solution works perfectly well if you choose to create an object instead of spawning it.

    With System create object, there is no need to have an instance on the layout.

    With spawning there is no need to have an instance either. You just have to make sure the object that is doing the spawning is on the layout. So only if this happens to be another instance of the object is it necessary to have that instance on the layout, but because you were talking about a catapult, I would expect the spawning to happen there.

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