Added parallax to mountains

This commit is contained in:
Mottributo 2023-03-23 16:35:28 +03:00
parent 8eab7faf27
commit 899dc410dc

View File

@ -608,8 +608,10 @@ function drawClouds() {
} }
function drawMountains() { function drawMountains() {
for (i = 0; i < mountains.length; i++) { for (i = 0; i < mountains.length; i++) {
push();
// slowing down translation to add parallax, the feeling of depth
translate(cameraPosX/8, 0);
noStroke(); noStroke();
fill(palette.mountain_shadow); fill(palette.mountain_shadow);
triangle( triangle(
mountains[i].x - mountains[i].width, mountains[i].x - mountains[i].width,
@ -628,6 +630,7 @@ function drawMountains() {
mountains[i].x - mountains[i].width / 1.5, mountains[i].x - mountains[i].width / 1.5,
floorPos_y floorPos_y
); );
pop();
} }
} }
function drawHeart(isEmpty, x, y, size) { function drawHeart(isEmpty, x, y, size) {