Start by making an array:
This is your 'board'. Think of it like a chessboard with squares. In there you can put letters to represent things in the game, eg 'p' for 'player'. This is what you manipulate with your program. When you move a monster you look in the screen to see if there's a 'p' where the monster is moving too. When you get up to a 16x16 board you can start putting in 'w' for a wall, etc.
Next you need a function to copy/translate the board to the LED display. You call this function on every pass through 'loop()'. For single color LEDs you can have different characters come out with different brightnesses. If you change to RGB LEDs you can have 'p', 'w' and 'm' come out as different colors. All that changes is the board->display function. This separation of board and display gives you great flexibility.
Wow! Thanks man! I think that's exactly what I need. My only question however is in your code example:
What you're trying to show is sort of having a led with x=3 and y=3 coordinated to do something right? Why are you using char
? Does a char
have special attributes that can memorize two variables at the same time or what? I don't fully understand this part.
And thanks for your example with walls and monsters.
Its very clear but I would prefer just simple example that would just make a dot run around a 3X3 LED screen and controlling it by buttons. If I would accomplish this, I will consider your idea with RGB LED'S, which I extremely like.
But thank you very much, fungus
. I kind of got a perspective of how approximately to do it.