Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
how east to make a maze with tile map? — Gideros Forum

how east to make a maze with tile map?

jollzyjollzy Member
edited November 2012 in Forum talk
I am very new to gideros , I ve done some games in corona sdk , as3 but this tile map never been my best to understand.

Any help would be appreciated. thanks in forward
Tagged:

Comments

  • Search the forums, there have been a few tile map examples, also see the "Desert" and "Sewers" examples that come with the install.

    You'd need to be more specific as to the type of tile map game (ie, top down, side scroller, platformer etc) you want to make before you can get any more help.

    Jon...
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
  • I am so sorry, you right.
    top down
  • With regards to a maze game, the first place to start is to generate a maze.
    I'd suggest using a 2D table to hold the generated data (actually generating maze data is too big a topic to discuss here - GIYF), you can always use a simple hand crafted table to start with,

    ie.
        map = {
          {1,1,1,1,1,1,1,1,1,1,1},
          {1,1,0,1,1,0,0,0,1,1,1},
          {1,1,0,1,1,1,1,0,1,1,1},
          {1,1,0,1,1,1,1,0,1,1,1},
          {1,1,0,0,0,0,0,0,1,1,1},
          {1,1,1,0,1,0,1,1,1,1,1},
          {1,1,1,0,1,0,1,1,0,0,1},
          {1,1,0,0,1,0,0,0,0,1,1},
          {1,1,1,1,1,1,1,1,0,1,1},
          {1,1,1,1,1,1,1,1,1,1,1}
    }
    Where a "1" represents a solid block and a "0" represents an empty space.


    Second - I'd then look to create a tilemap from the data (again the desert / sewer examples will help you here), look to see how to use TileMap:setTile, if memory serves then the x & y positions represent the position of the tile within the map (these need to be multiples of the tile size) and the tx & ty positions represent the column and row within the texture page of the tile to use (again I think these need to be expressed as multiples of the tile size).

    Once you've got that sorted then you have a data set that you can navigate around using whatever logic you need and a separate tile map that represents the visual display you want to produce.

    That should be enough to get you started.
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
  • jollzyjollzy Member
    edited November 2012
    thanks for your help. I dont have a problem understanding the 2d array map creations to use it in as3 too, but i have no idea how to generate the above mentioned array map to create the actual tiles(TileMap) in gideros.

    if i dont use your time could you do a small example to generate 2 types of tiles wall and road like you mentioned on the array 1,0

    or even better just a small example how to set the sprite tile in gideros , .
    these examples are very confusing to me (desert / sewer examples)

    thanks
  • jollzyjollzy Member
    edited November 2012
    I have got it finally thanks for all your help, but now i might need some help how to walk on these tiles. Can you tell me if the tiles position is the awnser for this question?

    ei: when the user clicks on a tile the hero moves to the clicked tile position , or there is a better solution for it?

    I looked at the jumper , what is your opinion about that path finder , is it fast enough no too processor hungry?




    thanks
  • @jollzy,
    you read the level data and for each element that you find, you place an image on the screen.

    The best way is to create a group that holds all of the tile images. Then place the images in this group which are relative to the i,j iterators as you iterate through the arrays. The images will be at j*TILE_WIDTH, i*TILE_HEIGHT.

    now you can simply scroll this group layer to provide the illusion of movement of a larger amp on the screen. At any point of time, you can determine the X,Y based on the row,col (consider the offset if you are scrolling the map) that way you can know which tile you want the player to go to.

    In short you need to work with co-ordinates that are the size of your level data, you can always calculate the absolute on screen positions from that using simple math.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • Hi

    sorry I am not sure if understand it right. what you mean group? also I manage to use the setTile in (sewer examples) so the maze is drawn already , I just not sure how to move my hero on the walkable tiles.

    :)
  • group => display.newGroup (as you have been used to from C*SDK) in Gideros it is a new sprite class that can serve as a parent instead of the stage.

    Let me have a look at the sewer examples.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • jollzyjollzy Member
    edited November 2012
    sorry you mean you check it out or you want me to send you the sewer example?

    Its a part of the gideros studio , and Atilim shows an example how to use a single layer and a multi layer tileMap.

    As far as I understood the layers are the actual tile set put on on screen . but not sure because he hardly commenting it. so for an absolute beginer its not much help.

    But I got as far as i was able to generate the maze , But as I said still have no idea how to make my hero walk on these tiles

    thanks everything
  • @jollzy,
    I meant let me have a look at it, I knew where it is, but I had not had a look at it.

    If you have a look at the sample, you can see how the layers are created as child layers (in a group) and how each of the tiles are loaded from the data onto each of the layer depending on the data set.

    You can place your player on top of all of these layers and move the layer below, so what you will see is the player staying in the same location and the layer scrolling (just like it would when you scroll in the example)
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • jollzyjollzy Member
    edited November 2012
    yes but i need the player to move onto a specific tile.

    Also I am not sure what is the layers in the examples , if I right the layer are the sets of tiles.
    in an other word each level can have a new layer like level1, level2 etc.. and this is the dataset which is a table {} of a type of tiles .
  • @jollzy,
    If you have had a look at my book, in Chapter 5 there is a section that talks about level management and it should help clear your concept.

    Determining a position on the grid is simple math. I will try to write up an article on this for all that might struggle with this concept.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • There is an article - Part I on using tilemaps at http://howto.oz-apps.com/2012/11/games-with-grids-tilemaps.html hope that helps you understand a few things.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • i will have a look at it later, Still its a bit of brain work need to gasp this new stuff. But I am very grateful for all your advice.

    thanks
Sign In or Register to comment.