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
Post a Comment