what does this mean? how did the autotile know which frame to pick?
Code:
ValueAtX( "Grid", ( LoopIndex("X Cells_" ) + LoopIndex("Y Cells_" ) * World_Width( "Tilemap" ) ) ) + ( ValueAtX( "Grid", ( ( LoopIndex("X Cells_" ) - 1 ) + LoopIndex("Y Cells_" ) * World_Width( "Tilemap" ) ) ) * 8 ) + ( ValueAtX( "Grid", ( ( LoopIndex("X Cells_" ) + 1 ) + LoopIndex("Y Cells_" ) * World_Width( "Tilemap" ) ) ) * 2 ) + ( ValueAtX( "Grid", ( LoopIndex("X Cells_" ) + ( LoopIndex("Y Cells_" ) - 1 ) * World_Width( "Tilemap" ) ) ) * 1 ) + ( ValueAtX( "Grid", ( LoopIndex("X Cells_" ) + ( LoopIndex("Y Cells_" ) + 1 ) * World_Width( "Tilemap" ) ) ) * 4 )
this post: http://community.clickteam.com/threads/95654-Auto-Tiling-Example-Basic-Example
so I understand the very beginning where the map is set to a certain size of pixels with 128 * 16 = 2048
and then sections each part of this into a grid with an array by diving 16 x 16 cells (I THINK/GUESS) with the second part:
Code:
Grid: Set X dimension index to VirtualWidth / 16 * Frame Height / 16
tbh, this sets it to: 16384 ? Is that the number of cells that comprise the map? Confused....
in the next part a nother loop is called "GO" and it starts a loop which basically Writes a random value of up to 2 to
Code:
( LoopIndex("X Cells" ) + LoopIndex("Y Cells" ) * World_Width( "Tilemap" ) )
so if I am reading it, and I like to think I am able to, this is skipping actual spots on teh grid as empty and only marking those which should be written? hrmmmmmmmm so like every for instance 1 + 1 + 128 times? so the array has a number every 130 times? im confused the array is getting a value at every 128 how come it says loop index + loop index + 128 and somehow first loop index with value is 128? shouldnt it be 130?
Array index is 0 based. does that affect it? let me see
Code:
loop_index(0) + (loop_index * World_Width)
is that how I should read that because the array in example has Base 1 index unchecked? maybe. or is it actually following basic order of operations?
Code:
loop_index + (loop_index * World_Width)
so it changes the value that the Grid should be written to based on a location decided by the index multipled against the loop index and then add +1 to account for the 0 based index grid, this makes more sense. Ok so I understand this but my original question is after getting this far and then getting to the "Map Build" section this happens:
Code:
Start loop XCells Tilemap.World_Width times (128)
On XCells loop
Start loop YCells Tilemap.World_Height times (128) // so 128 * 128 times = 16384 (the number from before)
On loop YCells
If ValueAtX (Grid) position (Loop Index of XCells) + (LoopIndex of YCells) * Tilemap.World_Width(128) == to 1
Create tileset at the 0,0 from tilemap (tile sprite)
stop animation of tileset (tile sprite)
set tileset.x to tileset.x + (LoopIndex(XCells) * 16)
set tileset.y to tileset.y + (LoopIndex(Ycells) * 16) // to set position and which we had made enough cell spots to account for grid size of tiles by diving by 16 at the start so this can be variable
>>>VERY CONFUSING PART FOR SETTING TILE GRAPHIC HERE<<<<<
For Animation frame to ValueAtX(Grid) to
ValueAtX( "Grid", ( LoopIndex("X Cells_" ) + LoopIndex("Y Cells_" ) * World_Width( "Tilemap" ) ) ) + ( ValueAtX( "Grid", ( ( LoopIndex("X Cells_" ) - 1 ) + LoopIndex("Y Cells_" ) * World_Width( "Tilemap" ) ) ) * 8 ) + ( ValueAtX( "Grid", ( ( LoopIndex("X Cells_" ) + 1 ) + LoopIndex("Y Cells_" ) * World_Width( "Tilemap" ) ) ) * 2 ) + ( ValueAtX( "Grid", ( LoopIndex("X Cells_" ) + ( LoopIndex("Y Cells_" ) - 1 ) * World_Width( "Tilemap" ) ) ) * 1 ) + ( ValueAtX( "Grid", ( LoopIndex("X Cells_" ) + ( LoopIndex("Y Cells_" ) + 1 ) * World_Width( "Tilemap" ) ) ) * 4 )
that last part I cant get, plese someone help me thank you