Destroy working differently with same sprites?

0 favourites
  • 12 posts
From the Asset Store
_______ Huge collection of metal fixtures ________
  • I would like to understand the logic behind this.

    If I drag the bomb to yellow square One and "bomb it" it destroys all the yellows. If I reload the screen (start over) and this time bomb a different yellow, it destroys a different number of yellows? If I would only want it to destroy the one and only yellow it is overlapping - how do I do it?

    Another question? If I "bomb" the RED ONE it destroys all the yellows. If I bomb RED TWO it only destroys yellow three and yellow four.

    I want to understand the principle behind this. I don´t want to use different sprites for each yellow since it doesn´t solve the "logical problem" in this (yeah, probably it is logical but what´s the logic behind it).

    Isn´t Is Overlapping a sort of Pick trigger. I would understand if it did always the same: Destroy all yellows or destroy the yellow you blow the bomb on but it changes depending on the yellow you choose to blow up.

    I wonder if the keywords are Pick, UID, parent object?

    Can you help me to understand this.

    Capx is here: https://dl.dropboxusercontent.com/u/104 ... test2.capx

    Video shows what I mean:

    Subscribe to Construct videos now
  • To help you understand what's happening here with the logic. When you destroy the first yellow, because of your logic in event 2, it then moves one of the other yellows to the same position and because the explosion is still there it destroys it. Even though it looks like they are being destroyed in their positions, what's actually happening is the yellows are moving to the green sprite/ explosion position as each one is destroyed. I would set up the set yellow sprite to green sprite position a bit differently, not based on the animation but through pinning.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To help you understand what's happening here with the logic. When you destroy the first yellow, because of your logic in event 2, it then moves one of the other yellows to the same position and because the explosion is still there it destroys it. Even though it looks like they are being destroyed in their positions, what's actually happening is the yellows are moving to the green sprite/ explosion position as each one is destroyed. I would set up the set yellow sprite to green sprite position a bit differently, not based on the animation but through pinning.

    Yes, it really is that. I posted there an example that works. However it can be improved.

  • martdsam nice! yeah pinning is a better way.

  • Thanks for replies

  • Pin does not have an image point where they are pinned. That´s a bit problem in some cases.

  • Pin does not have an image point where they are pinned. That´s a bit problem in some cases.

    Position the sprite, then pin. That is the rule.

    To move a sprite to a position in a way that its (any) imagepoint will be on that position ....

    Say targetX and targetY are the positions to move to.

    Say the to be moved sprite has 1 ImagePoint with position (expression) sprite.ImagePointX(1) and sprite.ImagePointY(1)

    Then set the sprites position to ...

    x = targetX - (sprite.x - sprite.ImagePointX(1))

    y = targetY - (sprite.y - sprite.ImagePointY(1))

    Then pin.

  • There is a plugin that allows you to pin to imagepoints which could also be useful.

    http://c2rexplugins.weebly.com/rex_pin2imagepoint.html

  • Sprite A = sprite to pin

    Sprite B = destination sprite.

    That plugin places the origin of sprite A to an imagepoint on sprite B, and pins.

    Guess i misread the question as ...

    Place an imagepoint of sprite A on the origin (or imagapoint) of Sprite B, pin.

  • Not exactly sure what OP wanted, request isn't very descriptive. Just providing general help lol.

  • Thanks again for all the replies. Very useful!

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