How do I Compare two Positions of two corresponding objects

0 favourites
  • 5 posts
From the Asset Store
Footsteps SFX Two contains 450 sounds of steps and jumps on different surfaces.
  • Hello Guys!

    Ive got a question about matching two objects based on their position. Basically i got two Sprites, each filled with 10 animation frames. One of this sprites containes spots and the other sprite contains dragable spriteimages.

    So i want to place the dragable sprites (sprite frame animation 3) to the corresponding spot sprites, i have placed on the layout (on the sprite animation frame 3). It should snap if you release the dragable sprite near the right spot sprite.

    -> compare the sprite.iid (dragable) with the sprite.iid (spot) -> if sprite.iid (dragable) = sprite.iid (spot) then place the dragable sprite onto the position of the spot sprite (with position threshold)

    -> How can i compare two positions of the same UID objects from two different sprites? (for excample UID 2 spirte positions should be compared)

    The game iam working on is remember details, where you have to drag objects onto the right places.

    Thank you very much - i hope my description is understandable

  • https://www.dropbox.com/s/plkmh9xztofj0 ... .capx?dl=0

    A thing about IID.

    IID is an index, the index of an object in a LIST of selected objects.

    The IID of an object depends on how you select (pick) the objects and on how many objects you selected (picked).

    Say .. this case:

    On drop (sprite) .. selects 1 sprite ... and that 1 sprite has IID = 0 (it is the first sprite in the list containing the selected items)

    Or .... that case ..

    On screen (sprite) ... selects all sprites that are on the screen. Their IID is the index one has in that list of selected sprites.

    Or ..

    Pick all (sprites)

    ... you guessed ....

  • 99Instances2Go Thank you very much for your answer! It worked perfectly and isnt that complicated i thought. I have another question right now: (Think it has something to do with the syntax or the order of the events)

    I want to make a tweenLite event, where iam moving the dragables onto the edge of the screen.

    Basically iam using a reapeat command. And then i want each dragable to move onto a destination point, i get by increasing the destination point (Position) by an offset to avoid overlapping.

    This code doesnt work. Can you tell me why? i want to compare the dragable.iid with the LoopRound variable iam increasing too each repeating round.

    I have made a screenshot:

    Note: Global variable RD_CountSpot = 10 - so this loop should be repeated 10 times -> RoundLoop should increase from 0 to 10 -> this should give me the ability to get each dragable.iid right?

    https://s8.postimg.org/eu76g4mbp/Repeat_Counter.jpg

  • Gosh. I understand what you ask. I dont understand the code.

    Dont understand how they can go to random places without overlapping. They have to 'explode' first.

    Been playing. And it lead to a complete disaster. I know you want to bounce them. And they still end up overlapping a lot. Tinkering.

    https://www.dropbox.com/s/5f4u90fgrwjf9 ... .capx?dl=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)