0
Z odpowiedzią

Two elements linked so they will move together

Ted Ollikkala 10 lat temu Ostatnio zmodyfikowane przez Inna Komarovsky 10 lat temu 8
I would like to know if there is a way, when two moving object intersect (collide), to have a png blink or fade in to act as an explosion. I can't figure it out because the png would have to be linked/locked and moving along with one of the elements in order to be triggered at the right place. Is there a way to lock two (or more) elements so they move together at all times (one of them would be hidden)?  
W trakcie analizy
Before I say my idea about this, could you tell me what is the method you want the two objects to move? They will move by a Drag effect? or by a Tap-Animate effect? 
One element is moving by drag and bounce (this element would hit the other element quite rapidly), the other object is moved by drag only (so it could be in a different place when it collides). Thanks, Alin - happy to hear your idea :-)
I will make a sample app of my idea of this and I will post it here as soon as I finish it. Thank you for your feedback Ted.
Cool, it's a neat challenge and well worth the effort if the effect looks somewhat realistic. It's terrible to have two objects collide perhaps you only hear a sound (crash or explosion) - visuals add a lot of value!
I've attached to this reply the sample app with my idea regarding this case:
Explosion sample.zip
So here's the idea:
We have:
1) two copies of the wall: one copy (named wall) will be the Intersect element; the second copy (name moving wall) will let you move the well as well as the hidden bouncing bomb and explosion across the screen.
2) one explosion element that will appear once the bomb will Intersect with the wall.
3)two copies of the bomb: one copy (name bomb) that will Intersect with the wall, and which you will be able to move across the screen; second copy called (bomb bounced) that will create the bounce effect of the bomb.
I used like 10 intersections for this, the elements of the Intersections are the bomb and the wall. 
The whole idea is that the bomb intersesct with the wall the explosion will fade in the bomb bounced will bounce to the original position, then the explosion will fade out and the copy of the wall will show, just so you will be able to move it were you want.
Let me know if this example helps and let me know if you have any questions regarding this sample. Thank you for your feedback.
Ah, so basically the trick to getting elements to move together is this:

Element Name: moving_wall

Action Set     1              2                3             4

Interaction: Drag         Drag         Drag            Drag
Behavior:    Move        Move        Move           Move
Target:       Self          Wall         Explosion    bomb_bounced

This effectively 'chains' them together so they move as one (with the layers acting on various conditions and being hidden or shown by intersections).

Very clever! And fun to play ;-) Thank you for the great example, Alin

Yes to move two elements you can have two Drag-Move actions sets,for itself and other element, on one of these two elements.