How do I Capturing coordinates of multiple tilemaps

0 favourites
  • 6 posts
From the Asset Store
This is a black tileset with 2 tilemaps, props, one animated character and more.
  • I'm using more than one tilemap, they connect by forming a larger map. Using Tilemap.PositionToTileX (player.X) and Tilemap.PositionToTileY (player.Y) I get the coordinates of only the first Tilemap located at 0,0. The other tilemaps do not return the values. How can I get these values? I figured the TileToPosition property might help, but I could not use it properly. Does anyone know how to proceed?

  • Hard to tell without looking at what you're doing but there's a couple of things to consider. One is that if you're using multiple tilemaps are you referencing them all in the events or only the first one? Maybe you need to put them into a family and reference that family instead so that it will trigger for all the tilemaps. I just tried a quick test with a textbox outputing the value of Tilemap.PositionToTileX(player.X) and Tilemap.PositionToTileX(player.Y) and the coordinates were returned fine, but I was only using one tilemap.

  • Hard to tell without looking at what you're doing but there's a couple of things to consider. One is that if you're using multiple tilemaps are you referencing them all in the events or only the first one? Maybe you need to put them into a family and reference that family instead so that it will trigger for all the tilemaps. I just tried a quick test with a textbox outputing the value of Tilemap.PositionToTileX(player.X) and Tilemap.PositionToTileX(player.Y) and the coordinates were returned fine, but I was only using one tilemap.

    They are all in one family. My intention is to create something like tactical movement, I would like to select a group of tiles around the character, and this selection remains indenpendent of the tilemap the character is in.

  • R0J0hound How to fill an array automatically, like this: https:// scontent.frec6-1. fna.fbcdn.net/v/t1.0-0/s480x480/16730213_1423093714396997_8512047485898734476_n. jpg?oh=bbd66497ef4caea251b3b0cad6dbde87&oe =590470D8

  • You can do it like this if array1 is size 5x5x2 and array2 is size 25x2x1, but I don't follow how it helps your op.

    array1: for each xyz

    --- array2: set value at (array1.curx+array1.cury*5, array1.curz) to array1.curValue

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When i make an example, it has to be fun for me too. So ... i made some choices.

    I have here 3 instances of a tilemap, and i use all 3 for a different purpose.

    1 to show the walls

    1 to show the field of vision

    1 to show a path to the mouse when that mouse is in the field of vision

    A click moves the player.

    But, finding a path in a tight maze with the official plugin is hell and way to slow.

    Using floodfill to calculate the fov is to time consuming for me for just an example

    So i am using a 3th party plugin (i am sure you will like it too)

    roguelike-plugin-c2-rot-js-interface_t118452

    That plugin can generate maps. But i dont use that feature. I just bring a pre made tilemap into the plugin.

    Once the tilemap is in the plugin, it can calculate all that i need in a snap.

    Besides that, i use the MoveTo plugin to move the player.

    behavior-moveto_t63156

    Up to you if you want to install the plugins to open the capx. Here is the capx:

    https://www.dropbox.com/s/rk4xlo545sisu ... .capx?dl=0

    Have fun.

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