How do I loop through one object type and change another obj

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Alright so I'm not thinking this is a bug but rather something about not being able to access (to my knowledge) the look count var.

    I'm trying to create an arrow (ObjB) that points to ObjA types when they are off the screen.

    I have x number of objects of type ObjA

    on startup I spawn x number of ObjB I check in debugger to make sure ObjA and ObjB counts are the same.

    Im checking in a for or foreach loop, tried both for when ObjA if off the screen. Once this is the case set inside the loop I try to set its "mapped" ObjB to visible and star changing its position. It seems this works a little bit but I notice some actions the objects affect eachother.

    Is there something like an IndexOf I can use so make sure the correct object is updated? Also is there a way I can access the loop iteration inside the loop like ObjA[LoopIter]?

    First time poster Thanks in advance for the Helpz!

  • You can pick objects based on their IID instead of their UID. However, a simpler solution would be to put both ObjA and ObjB in a container.

    Please post a screenshot of your problem or a capx next time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Very cool, Thank you for the quick response!!

    I was not aware of containers. It does seem easier to link them this way however I think this prop of containers make it not an option for me: If a condition picks one object in a container, every other associated object in its container is also picked.

    I think picking objects based on IID might be best but I'm not certain how to do this in a for loop as there seems to be no other choice but to select an object type as action.

    Below screenshot and GIF may help explain the issue:

    ObjA is the satellite

    and ObjB would be the arrow or satMarker from the above example

    In this example there are 2 arrows,satMarkers and satellites.

    I should also note, in debugger, both arrows and satMarkers are set to the position of the top satellite

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