Tsardall's Forum Posts

  • So using an array would be the best way. Does this method also works with multiple colour expending? So the same situation but instead of only one red patch there would also be a blue and a yellow one.

    Also how do I do I define "valid locations" since the map will evolve the valiud locations will also change.

  • Exemple:

    So in this case, I need to pick a random tile (every few seconds) around the red tiles and change them to red. and this until there is no more place for red tiles to spread.

    Thank you

    Tagged:

  • How do I check adjacent tiles when one is clicked? Can I do mouse(x,y)+10 (and after) -10 and after convert it into tile position?

    But I dont need all the adjacent to be of the right tiles

  • But I can't compare the position of the tiles since it could be any tiles, no specific values.

    So I can't replace "A" and "B" with numbers in:

    distance(Tilemap.TileToPositionX(Ax), Tilemap.TileToPositionY(Ay), Mouse.X, Mouse.y)<(32*1.5).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So I already made something similar but with sprites but couldn't figure out how to do it with tiles.

    In the image below when the button is active, the player can only paint the "tiles" that are directly adjacent to the blue "tiles".

    Is it possible to do the same with only a tilemap or will I also need other objects like an array?

    Thank you,

    Tagged:

  • I got this to work:

    It just change the tiles colour if the value of the array=0 at same tile position in the array using positiontotileX(mouse.x)&positiontotiley(mouse.y) And its bugged when condition on "every tick" it just colours a big square in the tilemap.

    But now I would need to do the contrary, set an array value when tile=0 (colour)

    And do I have to always rely on a specific position in this case (mouse.x,y) to change an array value? I would like to do like:at (tile.x,y) which i can’t figure out how.

    Also any tutorials online on how to use tilemaps with arrays? please

  • I can<t do all tiles manually, I would need to do something like this: Everywhere where there's a white tile, set the value of the array to 1. (at the same coodinate in the array for each)

    Is there a way to simply do: whatever the position if tile white set value of the array to 1 at the same position in the array?

    I tried to loop each tile to check if they are white but this just takes too much power, so I have to use specific coordinate like (mouse.x;mous.y) and convert it to tileposition which I won't be able to rely on later in my project.

  • Thanks a lot for the help, I understand It better now. 🙏

  • I tried doing something that would pick up the position of each tiles at start of the layout.(doing it manually would be way too long) but it doesnt work, only the "set size of the array" event works. I think there's something wrong with my loops too.

    I have never worked with arrays before and tilemaps so I am completly lost.

  • My tilemap is iregular its not a 100x100 (like the picture above), Also are there tutorial about using arrays with tilemaps, i haven<t found any and it owuld really help.

    Ok thank you a lot, I will try something again.

  • There are several ways to do this.

    How many values do you need to store for each tile? Will the set of values be the same for all tiles, or different? For example, water tiles will have "depth" value, ground tiles will have "walk_speed" and "solid" values etc.

    Will there be many tiles without any values? You can think of a Tilemap as a 2D array, which stores tile type (ground, sand, water, rock). So you don't have to store this info in the array.

    Do you need to store the array with all these values in the project, or will it be randomly generated in runtime?

    1. I would need to store about 4 variables For each tiles that would change independently during the game on certain condition

    2.The values won’t be random

    I want to do something line this for the tiles variable:

    (Ownership: unowned or country1 or country2)

    (State: Incorporated or non-incorporated)

    (And finally a variable that update if for exemple a blue tile is near an other tile mark as Unowned)

    🙏

    Also if I set an array the same size if the tilemap and sub-divide it by each tiles will it store these values as if they where « in »the tiles?

  • I've had trouble using arrays before and found a lot of information on how to use it with a Tilemap and what it can do.

    I think it can store information relating to a position? But that's about it.

    Could a array make each tile act as a unique object when it comes to information? For example, can each tiles store separate variables?

    If yes, how can I set an array with my tilemap if the tiles are not place uniformly:

    Thank you,

  • I have tried too and the CPU usage go hight when the camera is moving (in my test the fps where still very good despite the CPU struggling for some reasons)

    Also in debug mod without deleting/diseabling anything, its says that the draw calls take up 25% of the CPU but when removing literally everything else but the sprites, the draw calls are now taking 95% and the CPU is still used too 100%. So I am not sure whats the issue.

  • They have line of sight behaviour but I dont think its checking every thicks unless I made a mistake. Also I don t think a tilemap would work because its 1 object. I need all the sprite or tiles of the map to old informations like variables.

    Also I am using a 3d camera that moves could it change anything about the sprites updating?

  • I thought it was the line of sight behaviour that was causing the lag thats why I wanted an alternative to it,but now it’s probably that there’s to much sprite.

    I dont know I could change that since I want to be able to paint the map and larger sprite wouldn t look good.

    EXEMPLE:

    *Every cells are 5x5 pixels of resolution