Traversing 2D Arrays

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 410 Views - Last Post: 04 May 2013 - 02:56 PM Rate Topic: -----

#16 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2216
  • View blog
  • Posts: 9,351
  • Joined: 29-May 08

Re: Traversing 2D Arrays

Posted 04 May 2013 - 02:56 PM

You do know that the most of the graphics aren't persisted.
What with all additions?

Wouldn't some simple maths would help you a lot.
Is not the corner of a tile (assuming they're the same size)
PosX = ( tile_width  * x ) 
PosY = ( tile_height * y ) 


?
If so, then to draw a grid a tile I would simply have do the following
for y = 0 to tiles_high
  for x = 0 to tiles_wide
    PosX = x * Tile.Width
    PosY = y * Tile.Height
    drawRectangle(PosX,PosY, Tile.Width, Tile.Wide)
  next
next


wouldn't I?

This post has been edited by AdamSpeight2008: 04 May 2013 - 02:57 PM

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2