0
Besvaret

Changing Objects at Certain Coordinates

russellshaffer 10 år siden opdateret af Inna Komarovsky 10 år siden 7
In the "design" window of InteractBuilder, is there a way to create a behavior so when I drag an object to a certain coordinate within the window, the object changes?

For example, if a hat's hanging on a rack (at an angle), when I drag the hat to a character, how can I make it so, when the hat reaches that character, it changes to an upright hat and fits on the character's head?

russellshaffer
Under vurdering
You can do this using Intersections. This are the steps:
1) For the Hanging hat add a Drag-Move behavior.
2) On top of the character's head add a transparent element.
3) Add the other hat in the right position and make it not visible on execute.
4) Now add the following intersections between the hanging hat and the transparent element: one intersection with Hide behavior for the hanging hat;
one intersection with Show for the right positioned hat.

Let us know if you need anymore help with this and I will create a sample app showing you these steps. Thank you for your feedback.
Hey Alin,

I got lost at step 4. I've tried multiple different attempts at creating the right intersection, but nothing's working. Can you please create a sample app video to walk me through the steps? Thanks for your help.

russellshaffer
When you click the Intersection button, the yellow cross in the bottom left corner of Design mode, you'll see the window for setting up intersections.

For this effect, you'll be creating two different intersection behaviors. For both of them, Element 1 will be the hanging hat, and Element 2 will be the transparent element (or the character) with which the hat should intersect. The behavior should be to hide the hanging hat.

Then add another intersection by clicking the green plus sign in the intersection window. This intersection will have the same elements for Element 1 and Element 2. The behavior this time will be to show the hat that is placed on the character's head.

This means that when the hanging hat is moved over the character's hat, it should disappear and show the correctly-placed hat.

Does this work on your side? If not, I'll post a quick video.
Inna,

Thank you very much for the instructions and video. They both made it crystal clear for me on how to make this interaction happen with what I'm working on. And now I can get it to work perfectly!

russellshaffer
I'm so glad! This is an effect that people have asked about for a wide variety of activities, so after I made the video in response to your question we decided to add it to our user guide as well. So thank you! :)

Kundesupport af UserEcho