Posted 08 December 2013 - 10:04 AM
Hello everybody,
I'd like to know how you can read 'segments' from tables.
With that, I mean the following:
Lets say that I have this table (called image):
Using this table, I want it to read the lines, character by character. (Maybe by using term.readLine() or something?)
If you're good at guessing, you maybe already figured out that I want to use a table to 'pixel' a certain image on a screen, using a table.
For this one I only want white 'pixels' and spaces, but maybe for future things I'd like to use it (by using multiple different characters) to print whole 'coloured images'.
I have no clue how to make it do this.
So is there anybody around here that knows how you can do this?
If so, can you help me? C:
Kind regards,
- Semx11
Note: I know that this is possible, because nitrogenfingers also used this in one of his programs, called "goldrunner". In that game he uses a table with characters (like above) to make the program 'write' a level.
I'd like to know how you can read 'segments' from tables.
With that, I mean the following:
Lets say that I have this table (called image):
local image = {
"XXXOXXXOXXX",
"XOOOOXOOXOX",
"XXXOOXOOXXX",
"XOOOOXOOXOO",
"XOOOOXOOXOO"
}
Using this table, I want it to read the lines, character by character. (Maybe by using term.readLine() or something?)
X = term.setBackgroundColor(colors.white) term.write(" ") == So this will be a white 'pixel'
O = term.setBackgroundColor(colors.black) term.write(" ") == And this will just be a space (or a 'black pixel')
If you're good at guessing, you maybe already figured out that I want to use a table to 'pixel' a certain image on a screen, using a table.
For this one I only want white 'pixels' and spaces, but maybe for future things I'd like to use it (by using multiple different characters) to print whole 'coloured images'.
I have no clue how to make it do this.
So is there anybody around here that knows how you can do this?
If so, can you help me? C:
Kind regards,
- Semx11
Note: I know that this is possible, because nitrogenfingers also used this in one of his programs, called "goldrunner". In that game he uses a table with characters (like above) to make the program 'write' a level.