Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
How to know the end of the tile map — Gideros Forum

How to know the end of the tile map

albert988albert988 Member
edited March 2013 in General questions
I'm learning the example of this
http://www.giderosmobile.com/forum/discussion/2413/runnergame-template#Item_5

how can I know the end of the tile map and stop moving the tile map?

Comments

  • techdojotechdojo Guru
    Accepted Answer
    You'll have to keep a track of the width of the tile map (ie tilesize * number of tiles) and then just monitor the x (or y) position that you draw your map at so that it always stays on screen (just remember to account for the width of the screen).

    ie.
       local maxX = (mapTile_width * mapColumns) - ScreenWidth
    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
  • ScouserScouser Guru
    edited March 2013 Accepted Answer
    If you're scrolling left (i.e. your runner is going right) as in most runner games then your map X position will be negative so you will have to negate the maxX in @techdojo's example above. i.e.
    if scrollX <= -maxX then you have reached the edge of the map
Sign In or Register to comment.