How do I Capturing coordinates of multiple tilemaps

Get help using Construct 2

Post » Sun Feb 12, 2017 2:36 am

Image
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?
Last edited by vubidugil on Sun Feb 12, 2017 4:27 am, edited 1 time in total.
B
18
S
4
Posts: 48
Reputation: 1,088

Post » Sun Feb 12, 2017 4:16 am

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.
B
64
S
25
G
4
Posts: 204
Reputation: 6,993

Post » Sun Feb 12, 2017 4:26 am

signaljacker wrote: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.
B
18
S
4
Posts: 48
Reputation: 1,088

Post » Mon Feb 13, 2017 7:10 pm

@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

Image
B
18
S
4
Posts: 48
Reputation: 1,088

Post » Tue Feb 14, 2017 2:42 am

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
B
91
S
31
G
103
Posts: 5,240
Reputation: 67,766

Post » Tue Feb 14, 2017 11:46 am

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.
B
33
S
18
G
28
Posts: 2,475
Reputation: 20,914


Return to How do I....?

Who is online

Users browsing this forum: jasontoups and 1 guest