To get the next bottom element of a selected tile out of the tilemap

edited July 2013 in Development
Hi,
how can I get the next bottom element (id, class) of a selected tile without to loop through the whole tilemap?

Comments

  • Hi,

    gameQuery gives an unique id to each tiles constructed in the following way:
    $.gameQuery.tileIdPrefix+name+"_"+row+"_"+column


    This means that if your tilemap is called "foo" then you can access the tile at position (a,b) by writing:
    $("#"+$.gameQuery.tileIdPrefi+"foo_"+a+"_"+b);


    In the same way you can deduce the position (index-wise) of the tile by parsing it's id. This means that for a given tile you can find it's position and probe specifically the state of the tile just bellow.
  • Thank you Selim for this hugh explanation (similarly, thought to Stack Overflow). You're right about the moving of tiles, it's not recommendable. I will trying at first to implement the movable gameobjects as group of tiles and maybe detach them as required from playground to increase the gameperformance.
  • *sry I meant group of sprites not tiles :)
Sign In or Register to comment.