Moving pinned object / pinning multiple objects

Get help using Construct 2

Post » Fri Mar 22, 2013 10:43 am

(Topic edited: was "Select two objects of same type, how?". See below)

Hi!

Continuing with my jigsaw game, I want to test if a piece is near a consecutive piece, and then align them and pin them.

In Visual Basic, I would select CurrentPiece and Piece(Piece(CurrentPiece.LogicalX,LogicalY+1) and then, if they are "close" according to a given tolerance, I would align them and pin them.

But I don't know how to do this in Construct. If I do a "Select All" and then look for the left piece with a condition (Compare Instance Variable LogicalY=StoredLogicalY, Compare Instance Variable LogicalX=StoredLogicalX-1), I lost the focus on the original piece. How can I recover the focus so I can pin the first (lost focus) piece with the new one?

EDIT:

I can't cast a "Piece pin to Piece"

Maybe I should add an invisible object, pin it to the first and then pin it to the other one?

arcalaus2013-03-22 21:02:52
B
39
S
11
G
5
Posts: 132
Reputation: 8,228

Post » Fri Mar 22, 2013 8:58 pm

OK, I followed the way of adding an invisible object pinned to the first. But now I have to fight another difficulty:

See my sample file at

http://www.apagada.com/varios/jigsaw-tests/puzzle.capx


When you drag a piece near to the right neighbour, the neighbour is pinned to it, BUT:

1) You can't drag the neighbour to move the block to another piece, since the neighbour is "pinned" and inmovable (i.e. you can only drag the piece you moved first).

2) When you drag another piece to the block of pinned (stuck together) pieces, you cause some pieces break apart from the block and pin the new piece (instead of adding the new piece to the block).

Any Idea?
B
39
S
11
G
5
Posts: 132
Reputation: 8,228


Return to How do I....?

Who is online

Users browsing this forum: amarcelo, Magistross, PavleNikolic and 22 guests