Open AlexPitre opened 7 years ago
aw you're so close! take a look at what you're measuring the length of right now and think about what you're trying to measure the length of. lmk if you still can't figure it out.
if (index > index.length - 1){
index=0;
}
ok, so i knew it was in that line. and i've tried a few different things and moved the if statement around. and just retried them.
i'm understanding it as: when the index is at the last position, the index becomes position 0 again. but that isnt happening and when i change the increment in if statement, it doesn't really change anything and if i take the line out completely it still runs the same.
Your index
variable is a number, and the .length
method only works for arrays (as far as we've seen... it actually works for strings, too). You want to be comparing index
to the length of the burn
array instead of the length of itself, so it should read:
if (index > burn.length - 1){
index=0;
}
ah ha! i had it wrong in my notes!
once my array cycles through, the program stops.
How can I get it to start back at the beginning?
I'm struggling with a few things, but one at a time I guess. All the // stuff is another issue. https://alpha.editor.p5js.org/a.pitre/sketches/rkPxaaT9Z