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

Get help using Construct 2

Post » Sat Jul 09, 2016 7:45 pm

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!
B
4
Posts: 2
Reputation: 204

Post » Sat Jul 09, 2016 9:50 pm

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.
ImageImage
B
44
S
14
G
10
Posts: 166
Reputation: 7,779

Post » Sat Jul 09, 2016 11:23 pm

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:

Image

Image

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
B
4
Posts: 2
Reputation: 204


Return to How do I....?

Who is online

Users browsing this forum: vino7733 and 27 guests