The main feature and the main problem of the game
They reduce the size of the falling balls, create a shield and so on
if (distance < 0.5 * (point_properties.size + obj.size) && 0 == point_properties.flicker){
if (point_properties.lives > 0) {
make_splash(point_properties.position, 4);
point_properties.lives--;
point_properties.flicker += 60;
balls.splice(i, 1);
i--;
}
else {
make_splash(point_properties.position, 10);
death();
}
if(pills[i].type == "life"){
if(point_properties.lives < lives) { //lives = 3
push_pill_points("+1HP", obj.getPosition(), obj.force);
point_properties.lives = Math.min(point_properties.lives + 1, lives);
}
}
if(pills[i].type == "bomb"){
if(1000 > e.distanceTo(pills[i].position)) { //радиус смерти шаров
make_splash(e.position, 10);
balls.splice(i, 1);
i--;
score += 5;
push_pill_points(Math.ceil(20), e.getPosition(), e.force);
}
}
if(point_properties.sizewarped){
if(0.5999 < point_properties.sizefactor)
point_properties.sizewarped = false;
point_properties.sizefactor += 0.04 * (0.6 - point_properties.sizefactor);
} else
point_properties.sizefactor += 0.01 * (0 - point_properties.sizefactor);
point_properties.sizefactor = Math.max(Math.min(point_properties.sizefactor, 1), 0);
...
for (let i = 0; i < balls.length; i++) {
obj = balls[i];
obj.size = obj.originalSize * (1 - point_properties.sizefactor);
}
if (0 < point_properties.shield && distance < 0.5 * (4 * point_properties.size + obj.size)) {
make_splash(obj.position, 10);
balls.splice(i, 1);
i--;
score += 20;
push_pill_points(Math.ceil(20), obj.getPosition(), obj.force);
}
if(point_properties.timewarped){
if (0.5999 < point_properties.timefactor)
point_properties.timewarped = false;
point_properties.timefactor += 0.1 * (0.6 - point_properties.timefactor);
} else
point_properties.timefactor += 0.002 * (0 - point_properties.timefactor);
point_properties.timefactor = Math.max(Math.min(point_properties.timefactor, 1), 0);
...
y_fall_coeff = 2 * variable * (1 - point_properties.timefactor);
force multiplier
duration