I do not mean literally the element itself, but rather its number. That is, suppose the following array:
var disparos = {
colorBala: this.color;
potenciaBala: this.pB;
mL: this.mL;
}
var b = []; // Este array recibe valores segun la cantidad de disparos
var b = [disparos, disparos]; // Suponiendo que disparó 2 balas:
Assuming that
shots
represents a shot and has its properties, colors, functions , etc .
Then I want it if it has fired 1 time, so: var b = [disparos];
a canvas is created, the problem is that with forEach
it realizes the element itself, as if it changed its properties, etc, I only want it to act according to the number of elements, < strong> iterating for each shot that can be tens and so for each shot create a canvas drawing.