Board Game Tile Manipulation

0 favourites
  • 2 posts
From the Asset Store
A complete Carrom Board artwork for making an awesome board game.
  • So I have this grid laid out with each tile represented by a different, unique sprite.

    I have an XML file that I parse into a 2D array (X,Y) which represents the ~names~ of the adjacent tiles.

    For example,

    Tile1 is adjacent to Tile 2 and Tile 3

    Tile 2 is adjacent to Tile 1, Tile 4, and Tile 5

    So thusly:

    Tile 1 is

    (1,0) = Tile 2

    (1,1) = Tile 3

    Tile 2 is

    (2,0) = Tile 1

    (2,1) = Tile 4

    (2,2) = Tile 5

    ect.

    The thing is that the Tiles are only represented in the array by a STRING of its name, not object/sprite reference. How can I utilize this in events? I thought I could do something like MyArray.At(1,0).X to evaluate the x position of Tile 2 but realized that Construct 2 can't think that far ahead.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just realized, what if I did it by UID? How would that go about working? I tried to replace all the string names with just UID numbers, but I don't quite understand how I can call the UIDs.

    EDIT:

    Figured it out using the UIDs.

    I made a family of all the tile sprites I was using and then used System->Pick UID Instance Of (MyArray.At(X,Y))

    I don't quite understand why you need to have a family or a specific object for this. I wish you could just pick by UID straight up, isn't that what they are for? I'm sure there is some kind of engine technical restriction on that with unit types or some hubub though.

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