diff --git a/sketch.js b/sketch.js index 8a17a38..db8583d 100644 --- a/sketch.js +++ b/sketch.js @@ -527,21 +527,29 @@ function drawCanyon(t_canyon) { push(); fill(palette.canyon_river_color); rect(t_canyon.x - t_canyon.width / 2, floorPos_y, t_canyon.width, height); - if (frameCount % 4 == 0) { + + if ((frameCount % 2) == 0) { PointX = random( - t_canyon.x - t_canyon.width / 2, - t_canyon.x + t_canyon.width / 2 + t_canyon.x - t_canyon.width / 2 + 5, + t_canyon.x + t_canyon.width / 2 - 5 ); PointY = random(floorPos_y, height); - if (t_canyon.points.length > 3) { + if (t_canyon.points.length > 2) { t_canyon.points.shift(); } - t_canyon.points.add((PointX, PointY)); + t_canyon.points.push([PointX, PointY, random(20, 100)]); } - stroke(palette.canyon_river_wave_color); strokeWeight(5); - line(PointX, PointY, PointX, PointY + random(20, 100)); + for (k=0; k < t_canyon.points.length; k++) { + line( + t_canyon.points[k][0], + t_canyon.points[k][1], + t_canyon.points[k][0], + t_canyon.points[k][1] + t_canyon.points[k][2] + ); + } + pop(); } function drawCollectable(t_collectable) {