How to create a 2D array of objects in Ruby? -


I am making a map for my roguelike game and already I stumbled upon a problem. I want to make a two dimensional array of objects. In my last C ++ game I did this:

  square tile; // Tile map found in another file [MAP_WIDTH] [MAP_HEIGHT];  

I do not understand how I should do this with Ruby.

  theMap = Array.new (MAP_HEIGHT) {Array.new (MAP_WIDTH) {Tile. New}}  

Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -