removing coins over canyons; formatting
This commit is contained in:
parent
b2b1bf06ba
commit
eff904c5db
12
sketch.js
12
sketch.js
@ -347,6 +347,7 @@ function startGame(full_start, update_objects) {
|
|||||||
if (collectables[i - 1].x + 200 > finish_position_x) {
|
if (collectables[i - 1].x + 200 > finish_position_x) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
collectables[i] = {
|
collectables[i] = {
|
||||||
x: collectables[i - 1].x + 50 + 100 * random(0.5, 1),
|
x: collectables[i - 1].x + 50 + 100 * random(0.5, 1),
|
||||||
y: gameChar.possibleGroundPosY[
|
y: gameChar.possibleGroundPosY[
|
||||||
@ -355,6 +356,17 @@ function startGame(full_start, update_objects) {
|
|||||||
size: 75,
|
size: 75,
|
||||||
isFound: false,
|
isFound: false,
|
||||||
};
|
};
|
||||||
|
// Checking whether the coin is over a canyon;
|
||||||
|
// marking it as isFound (making it disabled) in case if.
|
||||||
|
for (k = 0; k < canyons.length; k++) {
|
||||||
|
if (
|
||||||
|
canyons[k].x - canyons[k].width / 2 < collectables[i].x
|
||||||
|
&&
|
||||||
|
canyons[k].x + canyons[k].width / 2 > collectables[i].x
|
||||||
|
) {
|
||||||
|
collectables[i].isFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user