Pin to Instance

0 favourites
  • 10 posts
From the Asset Store
Pin UI
$2.49 USD
Create a perfectly Pinned Interface for Any Device
  • Is there a way to pin instances of an object to a specific instance of another object? I'm using a dummy object to rotate the balls in a circle and I want to be able to assign balls to different rotation dummy objects.

    <img src="http://dl.dropbox.com/u/31346541/C2/Pin2InstanceID.jpg" border="0" />

  • for each dummy

    -----ball ID==Dummy ID--->ball:rotate around dummy.

    If that doesn't work in C2, try this (I mostly use classic, so I'm not sure if c2 has small differences with regards to picking)

    for each dummy

    ---for each ball

    -----ball ID==Dummy ID--->ball:rotate around dummy.

    alternatively you can store the dummy co-ords in 2 PVs in the balls, and get rid of the dummy objects altogether. This is less flexible because you can't manipulate the dummies around like normal objects (you need to reference the balls by ID grouping, then change all of their PVs at once), but you save on object count, which can help in a restricted environment (like phones).

  • Sorry, I don't quite follow. I'm not too experienced on the coding side of things.

    In the capx below there are 2 instances of the dummy object that are rotating at different speeds. The pin behavior doesn't allow me to specify which instance. All of the balls end up being attached to the 1st instance. I'm trying to find a way to have a 2nd set of ball rotate around the 2nd instance of the rotation dummy.

    Here is the .capx

    http://dl.dropbox.com/u/31346541/C2/Rotation.capx

  • Yes. Use the Pick nth Instance under the Systems option.

    So, it'd be:

    System | Pick Rotator instance 0

    Pin rotatingBallThings to Rotator

    System | Pick Rotator instance 1

    Pin otherRotatingBallThings to Rotator

  • Like this?

    <img src="http://dl.dropbox.com/u/31346541/C2/Pin2InstanceEvent1.JPG" border="0" />

    This didn't seem to work.

  • does this help?

    capx

  • Yes! That helped a lot. Thank you very much for the help!

    <img src="http://dl.dropbox.com/u/31346541/C2/Pin2Instance2.png" border="0" />

  • The method that vtrix shared works well. Now I'm wondering if anyone has suggestions about a cleaner way to implement the solution so that it can scale to N number of objects.

    Right now there are 2 rotation dummy objects with balls spinning around them. This is how it's setup in the capx.

    <img src="http://dl.dropbox.com/u/31346541/C2/PinSpam.jpg" border="0" />

    I experimented with some different "For Each" loops with no success. Any suggestions?

  • <img src="http://dl.dropbox.com/u/8367729/construct/pics/pinToRotate.png" border="0" />

    If you use families or just one yarn sprite with different animations for each colour then you can replace the three yarn lines with just one.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That looks much much cleaner. I just tested it out and it works great.

    Just to help me understand the tool better I'm wondering if someone could explain why the last loop I attempted didn't have the same result.

    <img src="http://dl.dropbox.com/u/31346541/C2/YarnLoop.png" border="0" />

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