How do I Select tiles from another tilemap

0 favourites
  • 8 posts
From the Asset Store
A set of retro 16-Bit Neon UI elements to make your menus pop!
  • I have 2 tilemap. One called Main Tile and another one called Ore Tile. How can i select a the tiles from Ore Tile while i work with the Main Tile? Or do i need to combine all the tilemaps into one tile?

  • I'm not sure what you are trying to do here, but if you want to set a tile of the ore tile, you should use ore tile set tile..

    You can call the tiles from ore tile through the expressions like you use for maintile in the above example..

  • Its a bit difficult to see what you are trying to do, but assume you want to use one tile map to spawn/change something on the other?

    You have to set up some condition for the Ore tile map and then change it for the Main tile. Here is a simple example:

    It uses two tile maps, one with orange boxes and one with green boxes. Based on where the orange boxes are placed I want to place green boxes on the right side of them.

    So the code:

    Using two loops to go through tile map 1, dividing the width and height with 50, because that's the size of the tiles will give me the tile index coordinate of the tile maps.

    Then checking whether the giving tile on tile map 1 = 0 and if that's the case I set the tile right of the selected tile on tile map 2 to a green square.

    You only really need to use positionToTile when you try to place a none tile map object, like a sprite on a tile map or if you want to track mouse position etc.

    If what you are trying is to get a random tile from your Ore map and use it for your main tile map.

    You just have to get the tile index using the same method I used above.

    Tilemap.width / Tile.width

    Tilemap.height / Tile.height

    And if you need to randomize it

    Random(Tilemap.width / Tile.width) etc.

  • Its a bit difficult to see what you are trying to do, but assume you want to use one tile map to spawn/change something on the other?

    You have to set up some condition for the Ore tile map and then change it for the Main tile. Here is a simple example:

    It uses two tile maps, one with orange boxes and one with green boxes. Based on where the orange boxes are placed I want to place green boxes on the right side of them.

    So the code:

    Using two loops to go through tile map 1, dividing the width and height with 50, because that's the size of the tiles will give me the tile index coordinate of the tile maps.

    Then checking whether the giving tile on tile map 1 = 0 and if that's the case I set the tile right of the selected tile on tile map 2 to a green square.

    You only really need to use positionToTile when you try to place a none tile map object, like a sprite on a tile map or if you want to track mouse position etc.

    If what you are trying is to get a random tile from your Ore map and use it for your main tile map.

    You just have to get the tile index using the same method I used above.

    Tilemap.width / Tile.width

    Tilemap.height / Tile.height

    And if you need to randomize it

    Random(Tilemap.width / Tile.width) etc.

    What i mean is how to set a tile from another tile set..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm not sure what you are trying to do here, but if you want to set a tile of the ore tile, you should use ore tile set tile..

    You can call the tiles from ore tile through the expressions like you use for maintile in the above example..

    Yes im looking for the expression and still no clue.. helpp

  • > I'm not sure what you are trying to do here, but if you want to set a tile of the ore tile, you should use ore tile set tile..

    >

    > You can call the tiles from ore tile through the expressions like you use for maintile in the above example..

    >

    Yes im looking for the expression and still no clue.. helpp

    I would gladly help you if I could only understand your question..

    You do understand that each tilemap can only contain its own tiles, right?

  • What i mean is how to set a tile from another tile set..

    As littlestain says, each tile map are an its own object you can't copy a single tile (Graphic) from one to another, if that is what you are trying to do? What you can do is load another tile map when you need to, but it would be a bad approach I think compared to just adding the needed tiles to the map or simply let tiles from Ore map overwrite those on the main tile map.

  • >

    > > I'm not sure what you are trying to do here, but if you want to set a tile of the ore tile, you should use ore tile set tile..

    > >

    > > You can call the tiles from ore tile through the expressions like you use for maintile in the above example..

    > >

    >

    > Yes im looking for the expression and still no clue.. helpp

    >

    I would gladly help you if I could only understand your question..

    You do understand that each tilemap can only contain its own tiles, right?

    Nevermind i decided to combine both the tile map into a single tile map. Thanks

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