Spider Shooter

Smantsar Siarhei

Play Game

js6 HTML5 webpack eslint babel

Problems

	Math.atan2(y, x);
	Math.atan2(±0, -0);// ±PI.
	Math.atan2(±0, +0);// ±0.
atan2

Problems

	Math.sin(x);
	Math.cos(x);
sin and cos

Collision of spiders

screen_handgun

Collision of spiders

for (let i = 0; i < spiders.length; i++) {
 let mod = 1;
 for (let j = i + 1; j < spiders.length; j++) {
  mod++;
  let count = 0;
  while (travers(spiders[i], spiders[j]) && count++ < 4) {
   if (mod % 2 == 0) {
    if (spiders[i].pos.y > spiders[j].pos.y) {
     ++spiders[i].pos.y;
     --spiders[j].pos.y;
    } else {
     --spiders[i].pos.y;
     ++spiders[j].pos.y;
    }
   } else {
    if (spiders[i].pos.x > spiders[j].pos.x) {
     ++spiders[i].pos.x;
     --spiders[j].pos.x;
    } else {
     --spiders[i].pos.x;
     ++spiders[j].pos.x;
    }
   }
  }
 }
}

Thank you