Processing.js - Array of arrays from javascript is undefined in Processing
in
Processing with Other Languages
•
3 months ago
When I run this script I get the error below.
Map is declared in javascript as an array of arrays with data in it, and prepared doesn't equal one for five seconds which gives the array plenty of time to get data inserted in all the elements. If I use "map[x]" rather than "map[x][y]" it works fine, so I'm thinking it's something with processing.js not being able to work with an array of arrays from javascript like I think if at all.
Map is declared in javascript as an array of arrays with data in it, and prepared doesn't equal one for five seconds which gives the array plenty of time to get data inserted in all the elements. If I use "map[x]" rather than "map[x][y]" it works fine, so I'm thinking it's something with processing.js not being able to work with an array of arrays from javascript like I think if at all.
- void draw()
{
size(window.innerHeight*(16/9),window.innerHeight);
background(0,255,0);
if(prepared == 1) {
for(x = 0;x < 64;x++) {
for(y = 0;y < 36;y++) {
if(map[x][y] == 0) {
fill(0,0,0);
}
if(map[x][y] == 1) {
fill(255,0,0);
}
rect(x*(width/64),y*(height/36),width/64,height/36);
}
}
}
}
1