Implementing 2D rendering in a 3X3 LED display.

mixania:
This is similar to computer programming.

No, it IS computer programming.

You've reached the point where you need to learn to program, not just hack around with code.

Start by making an array:

char board[3][3];

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.

Now... write the program to put things in the array and move them around... :slight_smile:

(Warning: This may not be the 'best' way to do it...but it's easy to program/debug - eg. The display function can easily send the board to the serial monitor when you hold down the 'debug mode' button...)