0 Favourites

How do I check location of object in Family?

  • Hi everyone,

    I have 3 objects in a family and I randomly spawn 30 of them on the map. I want to be able to determine the location of all the objects on the map.

    Thanks

  • Wouldn't this work?

    family1 on collision with family1

    family1 destroy

  • LittleStain

    I think I stated it wrongly in my original question. I already changed it to be clearer. I want to be able to get the location of each object of the randomly spawn objects from the same family and record them in an array.

  • Depends what you will do with the locations. You get all the XY positions to an array if that's what you mean for later use.

    The use. Call a function to do it when you want.

    On Function Name > Set the array size to: "Family.Count, 3, 1"

    Then subevent:

    For each Family

    Set value at (loopindex, 0) Family.X

    Set value at (loopindex, 1) Family.Y

    Set value at (loopindex, 2) Family.UID

    Now all the the XY locations will be saved to the Array if you want to use them later, and you can pick them again by using UID.

  • tunepunk

    Thanks for the explanation. How about if I only want to get the location the object that is overlapped?

    Currently I have

    On Start of layout, set array (0,0) t family.X and array (1,0) to family.y

    family is overlapping family: set array (0,1) to family.x and array (1,1) to family.y

    I know the event doesn't look right. I want to be able to record the overlapped object's location in the (0,1) (1,1) array.

  • I think if would be easier if you added a Bolean instance variable to objects that are overlapping. for example "IsOverlapping".

    If Family is overlapping Family. Set boolean to "isOverlapping" True.

    If you want to save all the overlapping objects to the array.

    On Function Name

    Pick Family by compare (IsOverlapping = 1)

    > Set the array size to: "Family.PickedCount, 3, 1"

    For each Family, isOverlapping = 1

    Set value at (loopindex, 0) Family.X

    Set value at (loopindex, 1) Family.Y

    Set value at (loopindex, 2) Family.UID

    Hope that helps.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • tunepunk

    I will try it. Still a bit confused though.

  • Hmmm. I think you need to specify an UID. On DragDrop2 start, save the UID also to the array of the tile that you are picking up, and on release the same thing. Then on "Swap" specify the same UID as well.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,139
karshinkoff's avatar
karshinkoff
Unread hot topic
167 14,497
DMT2005's avatar
DMT2005
Unread hot topic
102 6,404
Ashley's avatar
Ashley Construct Team Founder