Destroy working differently with same sprites?

Get help using Construct 2

Post » Tue Sep 20, 2016 8:29 am

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: https://www.youtube.com/watch?v=mRmt-1fnYrM
B
30
S
15
G
17
Posts: 137
Reputation: 10,873

Post » Tue Sep 20, 2016 11:31 am

Hi I am Samuel :)

My google play
B
42
S
10
G
1
Posts: 126
Reputation: 3,278

Post » Tue Sep 20, 2016 11:36 am

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.
B
47
S
17
G
81
Posts: 2,224
Reputation: 48,095

Post » Tue Sep 20, 2016 12:15 pm

plinkie wrote: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. :D :D
Hi I am Samuel :)

My google play
B
42
S
10
G
1
Posts: 126
Reputation: 3,278

Post » Tue Sep 20, 2016 12:58 pm

@martdsam nice! yeah pinning is a better way.
B
47
S
17
G
81
Posts: 2,224
Reputation: 48,095

Post » Tue Sep 20, 2016 2:09 pm

Thanks for replies :) Must try the pin thing again after a long time :)
B
30
S
15
G
17
Posts: 137
Reputation: 10,873

Post » Wed Sep 21, 2016 3:04 pm

Pin does not have an image point where they are pinned. That´s a bit problem in some cases.
B
30
S
15
G
17
Posts: 137
Reputation: 10,873

Post » Wed Sep 21, 2016 3:37 pm

tomi71 wrote: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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Sep 21, 2016 5:51 pm

There is a plugin that allows you to pin to imagepoints which could also be useful.
http://c2rexplugins.weebly.com/rex_pin2imagepoint.html
B
47
S
17
G
81
Posts: 2,224
Reputation: 48,095

Post » Wed Sep 21, 2016 10:55 pm

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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests