We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I need to make a game board - using an array - for a Bomberman game remake in Processing.
This means the game board / array (which is rather large [9x9] and has 3 values [a,b,c] throughout), has to be able to:
I'm pretty much a programming noob and I barely a clue how to make all of this work.. I've already set up the array though which look like this:
int [][] board = {
{b, b, b, b, b, b, b, b, b},
{b, a, b, a, b, a, b, c, b},
{b, c, c, a, a, a, a, a, b},
{b, c, a, a, c, a, a, a, b},
{b, c, c, b, a, b, c, a, b},
{b, a, c, a, a, a, a, a, b},
{b, b, a, b, c, b, b, c, b},
{b, a, a, a, c, a, a, c, b},
{b, b, b, b, b, b, b, b, b} };
(>b is solid, a is walking space and c is breakable)
And I have managed to draw it as a monochrome chessboard. Now I just have to figure out how to give each value the properties of the according block type.
Thanks for any help in advance :)
Answers
Do you know classes and objects?
Easiest would be a
class Cell
for the board holding position and type (bomb...) and color for each cellBut not strictly necessary
Use 2D array as you have above - see tutorial on that
Use a double
for
loop to fill it from your list abovetype[i][j] = board [i][j];
or just stick with the list you havesee below