I need to make something like this:
I have got 2 squares - If I click on 1 square it change their image to selected… Then I click on second square and this squares exchange their positions… You can image it like Bejeweled blitz game… you choose one diamond and then click other and they exchange their positions…
So I do this…
When I touch first square I write its position to 2 variables:
Square1X
Square1Y
Now, when I clicked on second square I write its position to:
Square2X
Square2Y
Then I set position of first block position to Square2X,Square2Y and second block position to Square1X,Square1X…
transition.to( e.target, { time=300, x=Square1X, transition=easing.linear })
transition.to( e.target, { time=300, y=Square1Y, transition=easing.linear })
transition.to( square, { time=300, x=Square2X, transition=easing.linear })
transition.to( square, { time=300, y=Square2Y, transition=easing.linear })
then I reset this values…
Works great with 2 squares, but if I add 3rd square it stop working… Problem is probably this:
I’m transitioning “square” a “e.target.” (what is 1st square…), but if there is more squares this transitioning stop working…
How can I make this working with more than 2 “squares” ?
Thanks. [import]uid: 59968 topic_id: 11942 reply_id: 311942[/import]