Moving pinned object / pinning multiple objects

0 favourites
  • 2 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • (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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

    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?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)