Convert String to Grid

Hey, I am kinda new to ruby… and programing…
Anyway, I had an idea of making an ascii game with ruby for the console.
I found a way to make (and break :P) grids, but can’t figure out how to
convert a map file into a grid. The map file has a key included and I
think I can figure out how to parse that but I cannot for the life of me
how to put the map into a grid, for character movement. Anyone know how?

On Wed, May 4, 2011 at 1:26 PM, Matthew D. [email protected]
wrote:

Could you show what your map file looks like, and what you would like it
to
look like after being processed? (ie what is a grid, an array of
arrays?)

Matthew D. wrote in post #996640:

Hey, I am kinda new to ruby… and programing…
Anyway, I had an idea of making an ascii game with ruby for the console.
I found a way to make (and break :P) grids, but can’t figure out how to
convert a map file into a grid. The map file has a key included and I
think I can figure out how to parse that but I cannot for the life of me
how to put the map into a grid, for character movement. Anyone know how?

I’m not new to ruby, nor to programming. I have no idea what a ‘grid’
is, nor what a ‘map file’ is. Are those universal terms that everyone
under the age of 15 understands? Hint: most programmers on forums are
over the age of 15.

He’s referring to a tile map so he can make a tile map
editor/converter with ruby. Think like glade but for games.

Think Lode Runner from the apple ][ days =)
Or even mario.

Here is an example of a graphical one:
http://images.mapeditor.org/tiled-qt-screenshot-2.png

The idea is once the map is created it can be saved (i.e. multi
dimensional array)

when it’s read back in the it builds the grid back on the screen and
act as a complete surface but with the memory footprint of a couple
small sized sprites.

op look into ncurses for your game. If you need help parsing the map
you will need to show us the map file. Just a simple screen example
not the whole file. Also include this “key” you refer to. Seeing you
don’t have control over the file where did it come from? What other
program/language created it? Is this homework?

~

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs