hi im trying to make an array in p5js of colors and defining them individually in setup and i always get the error “undefined is an invalid colorMode.” and i cant figure out why or find any specific documentation on defining arrays one by one
var columns;
var rows;
var board;
var player;
var kolorp;
let kolorc;
var w;
function setup() {
colorMode(RGB,255);
columns = 10;
rows = 20;
w = 30;
createCanvas(columns*w,rows*w);
kolorc = new Array(7);
kolorc[0] = new color(100,100,255);
kolorc[1] = new color(0 ,0 ,255);
kolorc[2] = new color(255,100,20 );
kolorc[3] = new color(100,100,20 );
kolorc[4] = new color(0 ,255,0 );
kolorc[5] = new color(255,0 ,255);
kolorc[6] = new color(255,0 ,0 );
board = new Array(columns);
for (var i = 0; i < columns; i++) {
board[i] = new Array(rows);
}
player = new Array(columns);
for (var i = 0; i < columns; i++) {
player[i] = new Array(rows);
}
kolorp = new Array(columns);
for (var i = 0; i < columns; i++) {
kolorp[i] = new Array(rows);
}
init();
}
function draw() {
for ( var i = 0; i < columns;i++) {
for ( var j = 0; j < rows;j++) {
if ((board[i][j] == 1)) {
fill(0);
strokeWeight(0);
rect(i*w, j*w, w, w);
}
}
}
for ( var i = 0; i < columns;i++) {
for ( var j = 0; j < rows;j++) {
if ((player[i][j] == 1)) {
fill(kolorc[kolorp[i][j]]);
strokeWeight(0);
rect(i*w, j*w, w, w);
}
}
}
}
function move() {
for (var i = 0; i < columns; i++) {
for (var j = 0; j < rows; j++) {
board[i][j] = floor(random(2));
player[i][j] = floor(random(2));
}
}
}
function init() {
for (var i = 0; i < columns; i++) {
for (var j = 0; j < rows; j++) {
board[i][j] = floor(random(2));
player[i][j] = floor(random(2));
}
}
}
im pretty new to p5js btw