Fixed canyon animation

This commit is contained in:
Mottributo 2023-03-23 15:49:47 +03:00
parent 48aaa55658
commit d3bd49b861

View File

@ -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) {