How do I Compare two Positions of two corresponding objects

Get help using Construct 2

Post » Tue Feb 21, 2017 3:46 pm

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 :)
B
10
S
2
Posts: 157
Reputation: 1,086

Post » Tue Feb 21, 2017 4:59 pm

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 ....
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Feb 22, 2017 12:43 pm

@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
B
10
S
2
Posts: 157
Reputation: 1,086

Post » Wed Feb 22, 2017 3:43 pm

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
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Feb 22, 2017 9:37 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: dop2000, Matthew de and 13 guests