How do I destroy a specific instance?

0 favourites
  • 3 posts
  • So, forgive me for asking but I could not quite find the right answer after searching the forums and the manual.

    So, this is what I'm trying to do.

    I'm spawning a bunch of squares that move upwards. When they collide, they are destroyed and do a set of things.

    • Award Points
    • Spawn another Sprite
    • Trigger the "Flash" for said sprite
    • Increase Combo Meter

    My problem lies first with the fact that the sprite flash and destruction for the new sprite affect all incoming instances.

    Secondly, I've pinned another sprite to this square. Every time a square is spawned, the second sprite or "Skin" is spawned accordingly. What I aiming to do, like the situation with the flash is when a specific block is destroyed, the "skin" that is pinned to it, is also destroyed.

    Instead,however, when one block is destroyed, all of the instances of the skin are destroyed. This is not true of the initial block that collided.

    I hope i was able to explain myself alright. Thank you for taking the time to look and as well for any reply.

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Add skin and square to the same container. Each skin will be created and destroyed automatically with its own square.

    construct.net/en/make-games/manuals/construct-3/project-primitives/objects/containers

    As for your first issue, you are doing something wrong. When you create a sprite instance, it's picked in this event. So if you need it to Flash or apply some other effects, you need to do in the same event or sub-events. If this doesn't help, please post your code or project.

  • Add skin and square to the same container. Each skin will be created and destroyed automatically with its own square.

    https://www.construct.net/en/make-games/manuals/construct-3/project-primitives/objects/containers

    As for your first issue, you are doing something wrong. When you create a sprite instance, it's picked in this event. So if you need it to Flash or apply some other effects, you need to do in the same event or sub-events. If this doesn't help, please post your code or project.

    Bruv, its like the smallest thing that can fix everything. So I turned the square, which is the "hitbox" for the enemy, into a container and added the "skin" to it. Now this pretty much fixed everything to a point. Now when the box is destroyed, only the skin associated with it is destroyed. However, the skin would stay where the box was created so, I had to then pin the "skin" to the box and there we go. I have seperate code to function as the A.I to the box and code to handle the animations of the skin.

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