Picking Objects that are pinned to a certain Object Type

0 favourites
  • 6 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hello!

    I'm trying to pick objects based on whether they are pinned to a certain object type. In my case, I want to pick all shadows that are pinned to switch blocks. I read a forum post that mentioned using the pinned UID. I have the event I created and the results in the pictures below. For some reason it's only picking some instances. I double checked in debug mode, and all of the shadows are pinned and have a pinned UID that matches the switch block they are pinned to. I'm guessing I messed up something somewhere, but I've tried a bunch of different things and haven't gotten it to work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why not just set them in first place?

    [Shadows] // Generates shadows onto terrain that casts them. ----+ ShadowCasters: On created ----+ System: For each ShadowCasters -----> ShadowCasters: Spawn shadow on layer 3 (image point 0) (create hierarchy: False) -----> shadow: Pin Pin to ShadowCasters (image point 0, angle: True, width: No, height: No, Z: False) -----> shadow: Set color to rgbEx(255, 255, 255) -----> ShadowCasters: Spawn shadow on layer 3 (image point 1) (create hierarchy: False) -----> shadow: Pin Pin to ShadowCasters (image point 1, angle: True, width: No, height: No, Z: False)

  • That's kind of a paired down file from the actual one I'm using. I just took out everything that didn't relate to this problem.

    I'm using the color change as a test. Basically, those switch bricks will turn into real bricks and back. When they're turned off, the shadows will turn invisible and lose their collision, but when they are turned on they'll turn visible and get their collision back.

    I'm just trying to figure out how I'll do that. It seems like from everything I've read that what I have there should be working. I'm guessing I have something in there wrong though.

    Maybe there's a better way of identifying the shadows as being pinned to the switch bricks? All I've really been able to find is the UID thing.

  • Add loop 'For each' for switch brick as condition:

    + System: For each switchbrick + System: Pick shadow where shadow.Pin.PinnedUID = switchbrick.UID -> shadow: Set color to rgbEx(255, 255, 255)

  • That worked! Thanks. I tried doing a for each of the shadows but hadn't thought to try it for the switch bricks.

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