Elkin's Game

Problems?

God, please, no

Collision

The main feature and the main problem of the game

Pills

They reduce the size of the falling balls, create a shield and so on

Collision

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();
    }

Pills

+1HP

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);
    }
}

Bomb

    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);
        }
    }

Minimize

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);
}

Shield

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);
} 

Timelapse

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);

Score +=

  • 20 for "Shield"
  • 50+20n for each pill (except "Life")
  • 5 for "Bomb"
  • 100*level for new level

Levels

force multiplier

duration

Thanks.

Elkin's game

By Victoria Budyonnaya

Elkin's game

  • 170