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 mountains = [];
|
||||
var collectables = [];
|
||||
var canyons = [];
|
||||
var rivers = [];
|
||||
var flagpole;
|
||||
|
||||
var text_size;
|
||||
@ -31,9 +31,9 @@ function setup() {
|
||||
ground_color0: color("#684622"),
|
||||
ground_color1: color("#734E26"),
|
||||
ground_color2: color("#7F562A"),
|
||||
canyon_river_color: color("#56C525"),
|
||||
canyon_river_wave_color: color("#4BAD21"),
|
||||
canyon_color: color("#7B672A"),
|
||||
river_river_color: color("#56C525"),
|
||||
river_river_wave_color: color("#4BAD21"),
|
||||
river_color: color("#7B672A"),
|
||||
pine_leaves_color: color("#3F4834"),
|
||||
maple_leaves_color: color("#4E3D1F"),
|
||||
pine_stem: color("#644D0D"),
|
||||
@ -286,9 +286,9 @@ function startGame(level_start) {
|
||||
},
|
||||
};
|
||||
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++) {
|
||||
trees_x[i] = random(-100, 10000);
|
||||
}
|
||||
@ -324,15 +324,15 @@ function startGame(level_start) {
|
||||
}
|
||||
for (i = 0; i < 100; i++) {
|
||||
if (i == 0) {
|
||||
canyons[0] = {
|
||||
rivers[0] = {
|
||||
x: 700,
|
||||
width: 50,
|
||||
points: [],
|
||||
};
|
||||
} else {
|
||||
if (canyons[i - 1].x + 600 > finish_position_x) break;
|
||||
canyons[i] = {
|
||||
x: canyons[i - 1].x + 300 + 200 * random(0.5, 1),
|
||||
if (rivers[i - 1].x + 600 > finish_position_x) break;
|
||||
rivers[i] = {
|
||||
x: rivers[i - 1].x + 300 + 200 * random(0.5, 1),
|
||||
width: 50 + 30 * random(),
|
||||
points: [],
|
||||
};
|
||||
@ -364,13 +364,13 @@ function startGame(level_start) {
|
||||
size: 75,
|
||||
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.
|
||||
for (k = 0; k < canyons.length; k++) {
|
||||
for (k = 0; k < rivers.length; k++) {
|
||||
if (
|
||||
canyons[k].x - canyons[k].width / 2 <
|
||||
rivers[k].x - rivers[k].width / 2 <
|
||||
collectables[i].x &&
|
||||
canyons[k].x + canyons[k].width / 2 >
|
||||
rivers[k].x + rivers[k].width / 2 >
|
||||
collectables[i].x
|
||||
) {
|
||||
collectables[i].isFound = true;
|
||||
@ -413,10 +413,10 @@ function draw() {
|
||||
// -------- MOUNTAINS -----------
|
||||
drawMountains();
|
||||
// -------- CANYONS -------------
|
||||
for (i = 0; i < canyons.length; i++) {
|
||||
canyon = canyons[i];
|
||||
drawCanyon(canyon);
|
||||
if (!gameChar.isFalling && !gameChar.isJumping) checkCanyon(canyon);
|
||||
for (i = 0; i < rivers.length; i++) {
|
||||
river = rivers[i];
|
||||
drawRiver(river);
|
||||
if (!gameChar.isFalling && !gameChar.isJumping) checkRiver(river);
|
||||
}
|
||||
// -------- TREES ---------------
|
||||
drawTrees();
|
||||
@ -499,10 +499,10 @@ function draw() {
|
||||
}
|
||||
pop();
|
||||
}
|
||||
function checkCanyon(t_canyon) {
|
||||
function checkRiver(t_river) {
|
||||
if (
|
||||
gameChar.x > canyon.x - canyon.width / 2 &&
|
||||
gameChar.x < canyon.x + canyon.width / 2
|
||||
gameChar.x > river.x - river.width / 2 &&
|
||||
gameChar.x < river.x + river.width / 2
|
||||
) {
|
||||
gameChar.isPlummeting = true;
|
||||
}
|
||||
@ -560,31 +560,31 @@ function drawGround() {
|
||||
}
|
||||
pop();
|
||||
}
|
||||
function drawCanyon(t_canyon) {
|
||||
function drawRiver(t_river) {
|
||||
push();
|
||||
fill(palette.canyon_river_color);
|
||||
rect(t_canyon.x - t_canyon.width / 2, floorPos_y, t_canyon.width, height);
|
||||
fill(palette.river_river_color);
|
||||
rect(t_river.x - t_river.width / 2, floorPos_y, t_river.width, height);
|
||||
|
||||
// Waves animation.
|
||||
if (frameCount % 2 == 0) {
|
||||
PointX = random(
|
||||
t_canyon.x - t_canyon.width / 2 + 5,
|
||||
t_canyon.x + t_canyon.width / 2 - 5
|
||||
t_river.x - t_river.width / 2 + 5,
|
||||
t_river.x + t_river.width / 2 - 5
|
||||
);
|
||||
PointY = random(floorPos_y, height);
|
||||
if (t_canyon.points.length > 2) {
|
||||
t_canyon.points.shift();
|
||||
if (t_river.points.length > 2) {
|
||||
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);
|
||||
for (k = 0; k < t_canyon.points.length; k++) {
|
||||
for (k = 0; k < t_river.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]
|
||||
t_river.points[k][0],
|
||||
t_river.points[k][1],
|
||||
t_river.points[k][0],
|
||||
t_river.points[k][1] + t_river.points[k][2]
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user