Swap two tiles position when touched?

  • Sup guys,

    I broke my head.

    There are tiles, when you click on one tile, and then on the second, need to swap these tiles position.

    Some event:

    img link: oi65.tinypic.com/1z4l9jo.jpg

    Everything works except for For Each :/

    How can this be done differently, or what needs to be changed in the current state?

    Regards.

  • I made a litte example how I would do it, maybe that helps:

    drive.google.com/uc

  • I made a litte example how I would do it, maybe that helps:

    https://drive.google.com/uc?export=download&id=1Ocmoy6ZCmwNeaoRrzIz7Z1oLPfy3XmsR

    So good friend! I really appreciate that you have taken the time for me!

    But I have a family of objects (Sprites) and it is necessary to select an object with the UID of the variable through for each. But for some magical reason this does not happen, although the object with such id exists, even through a unique change for the object did, did not help.

    Maybe I do not understand the meaning of For Each?

    Ps, simplified event:

    image.ibb.co/n3oqCU/xzczxc.png

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What is in your Family? Are using sprites as tiles instead of a tilemap?

  • What is in your Family? Are using sprites as tiles instead of a tilemap?

    Yes. Tilemap not quite suitable for needs.

    If in the tilemap it was possible to change the size of the image uploaded via "load from URL", this would solve my problem. Otherwise, for a given size, for example 500x500 in the editor, when I download a picture of 1000x1000 in a tile through "load from URL" my 500x500 size changes to 1000x1000 and the image gets lost.

  • The problem is the triggert event 'on touch'. It picks one instance, the 'for each' sees only one instance so there is no comparison with other UIDs possible. You have to use 'pick all' before 'for each'.

    I made another example. I hope that will help you more:

    drive.google.com/uc

  • Asmodean

    Thank u so much!

    This solves my question, you are my hero ♥

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