User Tag List

Results 1 to 2 of 2

Thread: what does this mean? how did the autotile know which frame to pick?

  1. #1
    Clicker

    Fusion 2.5 (Steam)

    Join Date
    Dec 2014
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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

  2. #2
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    BartekB's Avatar
    Join Date
    Aug 2013
    Posts
    667
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Here's an article on Neighbour Aware Tiles. It's for some programming language, but if you get the same ideas and such you'll get pretty much the same results.
    http://www.saltgames.com/article/awareTiles/

    If I have time I'll make a ForEach example of this.
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/R3WuvF3mHr

Similar Threads

  1. How to pick the special one?
    By DragonWing in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 16th October 2012, 01:35 AM
  2. pick up item
    By gamebuilder in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 18th June 2012, 11:31 PM
  3. Pick player
    By Taceo in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 21st July 2010, 10:36 PM
  4. Pick an object ...?
    By MattEsch in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 24th August 2008, 05:04 PM
  5. Pick object by...
    By haora in forum File Archive
    Replies: 0
    Last Post: 18th August 2007, 06:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •