If they are the position of the triangle, 6 values would make one triangle, so your loop can’t go on from 0 to door.length, cause that‘s 6 times as many triangles as there are coordinates.
Then you just have to set the first triangles (x1, y1 x2… and so on) manually to the corresponding index of the door[].
Now you just have to make that index increase with each loop. So you need to have the variable b as a part of your index calculation.
But just adding b would increase the index by 1 each loop, which is wrong… it would take the y1 of the first triangle and use it as x1 for the second and so on… so you need to increase by more than 1.
for(b=0;b<door.length; b++){
triangle(door[b+4],door[b+5],door[b+4],door[b+2],door[b+2],door[b+3]);
// Is it gonna loop through all the elements from array
}
First of all, explain how the door[]‘s values are related to the triangles you want to draw?
If they are the triangles vertex coordinates, then the length is wrong… it’s not divisible by 6.
Else, it might be the origin of the triangle, in that case you just can use the for loop like you had it and use the door[b] variable as the center…