Destroy sprites

0 favourites
  • 7 posts
From the Asset Store
A set of 10 pixel art animated magic effects with icons. 2 Fire, 2 Earth, 2 Wind, 2 Water, Portal, Explosion.
  • I have 10 (ten) sprite enemies and I have the event below:

    spriteShot On Colision with spriteEnemy -> spriteEnemy Destroy

    The problem is that I want to destroy all the enemies in my game when a I have the colision above (NOT only the enemy hit by shot).

    How can I do that ?

       Jos� Roberto.

  • an easy work around is turn the trigger into global event

    so make the trigger change a variable

    and when variable is changed, then destroy object.

  • I would use a function. If you have a DestroyAllEnemy routine, you can call it, which will operate without the have a sprite picked.

    Then you can just CallFunction from your On Collision event. Plus, it's reusable.

    Here, here's a simple example:

    db.tt/3pxTNdBM

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just use families.

  • Thanks PixelHero. A Function really solved the problem.

  • Another alternative to a function is to use the system condition "pick all". So your event could look like this:

    spriteShot: On Colision with spriteEnemy

    system: pick all spriteEnemy

    ---> spriteEnemy Destroy

  • Another alternative to a function is to use the system condition "pick all". So your event could look like this:

    spriteShot: On Colision with spriteEnemy

    system: pick all spriteEnemy

    ---> spriteEnemy Destroy

    You know, you'd think I notice something that obvious. If you aren't interested in re-use, that's definitely the most direct method, and less error prone (you can't misspell it) <img src="smileys/smiley1.gif" border="0" align="middle" />

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