Skip to main content
11 events
when toggle format what by license comment
Apr 18, 2019 at 14:04 history edited Richard Marskell - Drackir CC BY-SA 4.0
Updated dead links to archive.org links.
Apr 13, 2017 at 12:18 history edited CommunityBot
replaced http://gamedev.stackexchange.com/ with https://gamedev.stackexchange.com/
Mar 29, 2012 at 20:39 comment added Richard Marskell - Drackir @BrettW - A valid point. Thanks. It got me wondering how 2D arrays are stored in .Net (Row-major order. Learned something new today! :-) ). However, after updating my code, I realized that it's exactly the same as what you're describing, just with the variables switched. The difference is in what order the tiles get drawn. My current example code draws top-to-bottom, left-to-right whereas what you describe would draw left-to-right, top-to-bottom. So, for the sake of simplicity, I decided to revert it back to the original. :-)
Mar 29, 2012 at 20:22 history rollback Richard Marskell - Drackir
Rollback to Revision 1
Mar 29, 2012 at 20:20 history edited Richard Marskell - Drackir CC BY-SA 3.0
Forgot to change x,y to y,x
Mar 29, 2012 at 19:45 history edited Richard Marskell - Drackir CC BY-SA 3.0
Switched loop order.
Mar 29, 2012 at 19:20 comment added Brett W Typically with a 2D array you want to use the first dimension as your Y and the next as your X. In memory an array is going to be sequentially 0,0-i then 1,0-i. If you do nested loops with X first hen you are actually jumping back and forth in memory instead of following a sequential path of reading. Always for (y) then for (x).
Mar 29, 2012 at 12:28 comment added Richard Marskell - Drackir @Mikalichov - Glad I could help! :)
Mar 29, 2012 at 12:12 comment added Cristol.GdM Waow, that's twice more info than I asked, and pretty much answers all the questions I didn't ask, great, thanks :)
Mar 29, 2012 at 12:11 vote accept Cristol.GdM
Mar 29, 2012 at 4:59 history answered Richard Marskell - Drackir CC BY-SA 3.0