bulk renamed canyon into river
This commit is contained in:
parent
6ff8a3fd1a
commit
37549d0de0
70
sketch.js
70
sketch.js
@ -15,7 +15,7 @@ var trees_x = [];
|
|||||||
var clouds = [];
|
var clouds = [];
|
||||||
var mountains = [];
|
var mountains = [];
|
||||||
var collectables = [];
|
var collectables = [];
|
||||||
var canyons = [];
|
var rivers = [];
|
||||||
var flagpole;
|
var flagpole;
|
||||||
|
|
||||||
var text_size;
|
var text_size;
|
||||||
@ -31,9 +31,9 @@ function setup() {
|
|||||||
ground_color0: color("#684622"),
|
ground_color0: color("#684622"),
|
||||||
ground_color1: color("#734E26"),
|
ground_color1: color("#734E26"),
|
||||||
ground_color2: color("#7F562A"),
|
ground_color2: color("#7F562A"),
|
||||||
canyon_river_color: color("#56C525"),
|
river_river_color: color("#56C525"),
|
||||||
canyon_river_wave_color: color("#4BAD21"),
|
river_river_wave_color: color("#4BAD21"),
|
||||||
canyon_color: color("#7B672A"),
|
river_color: color("#7B672A"),
|
||||||
pine_leaves_color: color("#3F4834"),
|
pine_leaves_color: color("#3F4834"),
|
||||||
maple_leaves_color: color("#4E3D1F"),
|
maple_leaves_color: color("#4E3D1F"),
|
||||||
pine_stem: color("#644D0D"),
|
pine_stem: color("#644D0D"),
|
||||||
@ -286,9 +286,9 @@ function startGame(level_start) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
cameraPosX = gameChar.x;
|
cameraPosX = gameChar.x;
|
||||||
// Creating trees, clouds, mountains, canyons, collectables.
|
// Creating trees, clouds, mountains, rivers, collectables.
|
||||||
{
|
{
|
||||||
// Creating trees, clouds, mountains, canyons, collectables, platforms, enemies.
|
// Creating trees, clouds, mountains, rivers, collectables, platforms, enemies.
|
||||||
for (i = 0; i < 150; i++) {
|
for (i = 0; i < 150; i++) {
|
||||||
trees_x[i] = random(-100, 10000);
|
trees_x[i] = random(-100, 10000);
|
||||||
}
|
}
|
||||||
@ -324,15 +324,15 @@ function startGame(level_start) {
|
|||||||
}
|
}
|
||||||
for (i = 0; i < 100; i++) {
|
for (i = 0; i < 100; i++) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
canyons[0] = {
|
rivers[0] = {
|
||||||
x: 700,
|
x: 700,
|
||||||
width: 50,
|
width: 50,
|
||||||
points: [],
|
points: [],
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (canyons[i - 1].x + 600 > finish_position_x) break;
|
if (rivers[i - 1].x + 600 > finish_position_x) break;
|
||||||
canyons[i] = {
|
rivers[i] = {
|
||||||
x: canyons[i - 1].x + 300 + 200 * random(0.5, 1),
|
x: rivers[i - 1].x + 300 + 200 * random(0.5, 1),
|
||||||
width: 50 + 30 * random(),
|
width: 50 + 30 * random(),
|
||||||
points: [],
|
points: [],
|
||||||
};
|
};
|
||||||
@ -364,13 +364,13 @@ function startGame(level_start) {
|
|||||||
size: 75,
|
size: 75,
|
||||||
isFound: false,
|
isFound: false,
|
||||||
};
|
};
|
||||||
// Checking whether the coin is over a canyon;
|
// Checking whether the coin is over a river;
|
||||||
// marking it as isFound (making it disabled) in case if.
|
// marking it as isFound (making it disabled) in case if.
|
||||||
for (k = 0; k < canyons.length; k++) {
|
for (k = 0; k < rivers.length; k++) {
|
||||||
if (
|
if (
|
||||||
canyons[k].x - canyons[k].width / 2 <
|
rivers[k].x - rivers[k].width / 2 <
|
||||||
collectables[i].x &&
|
collectables[i].x &&
|
||||||
canyons[k].x + canyons[k].width / 2 >
|
rivers[k].x + rivers[k].width / 2 >
|
||||||
collectables[i].x
|
collectables[i].x
|
||||||
) {
|
) {
|
||||||
collectables[i].isFound = true;
|
collectables[i].isFound = true;
|
||||||
@ -413,10 +413,10 @@ function draw() {
|
|||||||
// -------- MOUNTAINS -----------
|
// -------- MOUNTAINS -----------
|
||||||
drawMountains();
|
drawMountains();
|
||||||
// -------- CANYONS -------------
|
// -------- CANYONS -------------
|
||||||
for (i = 0; i < canyons.length; i++) {
|
for (i = 0; i < rivers.length; i++) {
|
||||||
canyon = canyons[i];
|
river = rivers[i];
|
||||||
drawCanyon(canyon);
|
drawRiver(river);
|
||||||
if (!gameChar.isFalling && !gameChar.isJumping) checkCanyon(canyon);
|
if (!gameChar.isFalling && !gameChar.isJumping) checkRiver(river);
|
||||||
}
|
}
|
||||||
// -------- TREES ---------------
|
// -------- TREES ---------------
|
||||||
drawTrees();
|
drawTrees();
|
||||||
@ -499,10 +499,10 @@ function draw() {
|
|||||||
}
|
}
|
||||||
pop();
|
pop();
|
||||||
}
|
}
|
||||||
function checkCanyon(t_canyon) {
|
function checkRiver(t_river) {
|
||||||
if (
|
if (
|
||||||
gameChar.x > canyon.x - canyon.width / 2 &&
|
gameChar.x > river.x - river.width / 2 &&
|
||||||
gameChar.x < canyon.x + canyon.width / 2
|
gameChar.x < river.x + river.width / 2
|
||||||
) {
|
) {
|
||||||
gameChar.isPlummeting = true;
|
gameChar.isPlummeting = true;
|
||||||
}
|
}
|
||||||
@ -560,31 +560,31 @@ function drawGround() {
|
|||||||
}
|
}
|
||||||
pop();
|
pop();
|
||||||
}
|
}
|
||||||
function drawCanyon(t_canyon) {
|
function drawRiver(t_river) {
|
||||||
push();
|
push();
|
||||||
fill(palette.canyon_river_color);
|
fill(palette.river_river_color);
|
||||||
rect(t_canyon.x - t_canyon.width / 2, floorPos_y, t_canyon.width, height);
|
rect(t_river.x - t_river.width / 2, floorPos_y, t_river.width, height);
|
||||||
|
|
||||||
// Waves animation.
|
// Waves animation.
|
||||||
if (frameCount % 2 == 0) {
|
if (frameCount % 2 == 0) {
|
||||||
PointX = random(
|
PointX = random(
|
||||||
t_canyon.x - t_canyon.width / 2 + 5,
|
t_river.x - t_river.width / 2 + 5,
|
||||||
t_canyon.x + t_canyon.width / 2 - 5
|
t_river.x + t_river.width / 2 - 5
|
||||||
);
|
);
|
||||||
PointY = random(floorPos_y, height);
|
PointY = random(floorPos_y, height);
|
||||||
if (t_canyon.points.length > 2) {
|
if (t_river.points.length > 2) {
|
||||||
t_canyon.points.shift();
|
t_river.points.shift();
|
||||||
}
|
}
|
||||||
t_canyon.points.push([PointX, PointY, random(20, 100)]);
|
t_river.points.push([PointX, PointY, random(20, 100)]);
|
||||||
}
|
}
|
||||||
stroke(palette.canyon_river_wave_color);
|
stroke(palette.river_river_wave_color);
|
||||||
strokeWeight(5);
|
strokeWeight(5);
|
||||||
for (k = 0; k < t_canyon.points.length; k++) {
|
for (k = 0; k < t_river.points.length; k++) {
|
||||||
line(
|
line(
|
||||||
t_canyon.points[k][0],
|
t_river.points[k][0],
|
||||||
t_canyon.points[k][1],
|
t_river.points[k][1],
|
||||||
t_canyon.points[k][0],
|
t_river.points[k][0],
|
||||||
t_canyon.points[k][1] + t_canyon.points[k][2]
|
t_river.points[k][1] + t_river.points[k][2]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user