Rename variable
This commit is contained in:
@@ -242,8 +242,7 @@
|
|||||||
const shipRadius = +shipBody.getAttribute('r');
|
const shipRadius = +shipBody.getAttribute('r');
|
||||||
|
|
||||||
const legs = ship.querySelector("#legs");
|
const legs = ship.querySelector("#legs");
|
||||||
// const walls = document.querySelectorAll('.wall:not(.inverse)');
|
const wallElements = document.querySelectorAll('.wall');
|
||||||
const walls = document.querySelectorAll('.wall');
|
|
||||||
const bulletsContainer = document.querySelector("#bullets");
|
const bulletsContainer = document.querySelector("#bullets");
|
||||||
const triangleContainer = document.querySelector('#triangles');
|
const triangleContainer = document.querySelector('#triangles');
|
||||||
const linesContainer = document.querySelector("#lines");
|
const linesContainer = document.querySelector("#lines");
|
||||||
@@ -254,7 +253,7 @@
|
|||||||
const bulletPt = svg.createSVGPoint();
|
const bulletPt = svg.createSVGPoint();
|
||||||
const cornerPt = svg.createSVGPoint();
|
const cornerPt = svg.createSVGPoint();
|
||||||
|
|
||||||
const allWallCorners = [...walls].map(wall => {
|
const allWallCorners = [...wallElements].map(wall => {
|
||||||
const cs = wall.getAttribute('points').split(' ').map(coords => {
|
const cs = wall.getAttribute('points').split(' ').map(coords => {
|
||||||
const [x, y] = coords.split(',');
|
const [x, y] = coords.split(',');
|
||||||
return [+x, +y];
|
return [+x, +y];
|
||||||
@@ -263,7 +262,7 @@
|
|||||||
return wall.classList.contains("inverse") ? cs.reverse() : cs;
|
return wall.classList.contains("inverse") ? cs.reverse() : cs;
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapWalls = [...walls].map(node => {
|
const mapWalls = [...wallElements].map(node => {
|
||||||
const corners = node.getAttribute('points').split(' ').map(coords => {
|
const corners = node.getAttribute('points').split(' ').map(coords => {
|
||||||
const [x, y] = coords.split(',');
|
const [x, y] = coords.split(',');
|
||||||
const pt = svg.createSVGPoint();
|
const pt = svg.createSVGPoint();
|
||||||
@@ -530,7 +529,7 @@
|
|||||||
bulletPt.x = x;
|
bulletPt.x = x;
|
||||||
bulletPt.y = y;
|
bulletPt.y = y;
|
||||||
|
|
||||||
if (bullet.time > 0 && ![...walls].some(w => w.isPointInFill(bulletPt))) {
|
if (bullet.time > 0 && ![...wallElements].some(w => w.isPointInFill(bulletPt))) {
|
||||||
[bullet.x, bullet.y] = wrapPos(x, y);
|
[bullet.x, bullet.y] = wrapPos(x, y);
|
||||||
bullet.node.style.transform = `translate(${bullet.x}px, ${bullet.y}px)`;
|
bullet.node.style.transform = `translate(${bullet.x}px, ${bullet.y}px)`;
|
||||||
} else {
|
} else {
|
||||||
@@ -900,7 +899,7 @@
|
|||||||
// allStartingEdges = findAllEdges(edgePts, position);
|
// allStartingEdges = findAllEdges(edgePts, position);
|
||||||
s.node.style.transform = `translate(${s.position.x}px, ${s.position.y}px)`;
|
s.node.style.transform = `translate(${s.position.x}px, ${s.position.y}px)`;
|
||||||
|
|
||||||
walls.forEach(w => w.setAttribute('fill', 'black'));
|
wallElements.forEach(w => w.setAttribute('fill', 'black'));
|
||||||
// bg.style.fill = 'black';
|
// bg.style.fill = 'black';
|
||||||
time.innerText = "0";
|
time.innerText = "0";
|
||||||
}
|
}
|
||||||
@@ -941,7 +940,7 @@
|
|||||||
if (s.collision && !s.isLanded) {
|
if (s.collision && !s.isLanded) {
|
||||||
started = false;
|
started = false;
|
||||||
isReadingKeys = false;
|
isReadingKeys = false;
|
||||||
walls.forEach(w => w.setAttribute('fill', 'red'));
|
wallElements.forEach(w => w.setAttribute('fill', 'red'));
|
||||||
// bg.style.fill = 'red';
|
// bg.style.fill = 'red';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Reference in New Issue
Block a user