Fixed canyon animation
This commit is contained in:
parent
48aaa55658
commit
d3bd49b861
22
sketch.js
22
sketch.js
@ -527,21 +527,29 @@ function drawCanyon(t_canyon) {
|
|||||||
push();
|
push();
|
||||||
fill(palette.canyon_river_color);
|
fill(palette.canyon_river_color);
|
||||||
rect(t_canyon.x - t_canyon.width / 2, floorPos_y, t_canyon.width, height);
|
rect(t_canyon.x - t_canyon.width / 2, floorPos_y, t_canyon.width, height);
|
||||||
if (frameCount % 4 == 0) {
|
|
||||||
|
if ((frameCount % 2) == 0) {
|
||||||
PointX = random(
|
PointX = random(
|
||||||
t_canyon.x - t_canyon.width / 2,
|
t_canyon.x - t_canyon.width / 2 + 5,
|
||||||
t_canyon.x + t_canyon.width / 2
|
t_canyon.x + t_canyon.width / 2 - 5
|
||||||
);
|
);
|
||||||
PointY = random(floorPos_y, height);
|
PointY = random(floorPos_y, height);
|
||||||
if (t_canyon.points.length > 3) {
|
if (t_canyon.points.length > 2) {
|
||||||
t_canyon.points.shift();
|
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);
|
stroke(palette.canyon_river_wave_color);
|
||||||
strokeWeight(5);
|
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();
|
pop();
|
||||||
}
|
}
|
||||||
function drawCollectable(t_collectable) {
|
function drawCollectable(t_collectable) {
|
||||||
|
Loading…
Reference in New Issue
Block a user