Destroy Object by name

This forum is currently in read-only mode.
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I see that there is a way to create object by name, but I can't find a way to destroy object by name. Essentially what I am trying to is I have three health sprite images called health1, health2, and health3. The player will have a private variable starting at 4. When the player is killed the pv is decremented by one and if not 0 the corresponding health & pv is destroyed...

    However, I can't find a action to do that. Any ideas?

  • If I am not misunderstanding, it should be in the actions for the object itself? Rather than an action under System, I mean.

    "Destroy" is the name.

    Depending on what you're doing, you might also be able to use three or four animation frames for your health sprite, with the animation speed set to 0, then just change the frame.

    It would also be possible to destroy an object by unique ID or object ID, using "pick by comparison", but is only needed if you have multiple instances of one sprite object (all having the same name/object ID, I mean).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It would be better to use four animation frames than four sprites - it makes more sense that way, and you wouldn't need a 'destroy object by name' action.

  • Thanks Ashyraccoon and Ashley. Animation frames completely skipped my mind. It makes much more sense and is simpler too!

  • just for thread completeness: families could have also been used.

    (Animation frames is probably easier)

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