diff --git a/html/images/space.svg b/html/images/space.svg
index c21f046..37c8cc3 100644
--- a/html/images/space.svg
+++ b/html/images/space.svg
@@ -1110,16 +1110,11 @@ function updateShip(s, elapsed) {
const degrees = s.degrees;
ay += gravity;
- console.log("s.acceleration", ax, ay);
-
-
s.velocity = {
x: vx > 0 && vx + ax <= 0 ? 0 : vx + ax,
y: vy > 0 && vy + ay <= 0 ? 0 : vy + ay
};
- console.log("s.v", s.velocity.x, s.velocity.y);
-
s.angularVelocity = angularVel + angularAcc;
const friction = 0.05;
@@ -1154,9 +1149,6 @@ function updateShip(s, elapsed) {
s.degrees = degrees + dDelta;
current = s.collision;
- // const tempRadius = 7;
-
- // s.collision = detectCollision([px, py], p, s.velocity, tempRadius, map);
s.collision = detectCollision([px, py], p, s.velocity, s.radius, map, s.gearDown);
if (!current && s.collision) console.log("COLLISION", s.collision);
@@ -1173,11 +1165,11 @@ function updateShip(s, elapsed) {
posP = s.collision.position;
}
- // s.velocity = { x: 0, y: 0 };
+ s.velocity = { x: 0, y: 0 };
// s.position = { x: posP.x, y: posP.y }
s.position = { x: p.x, y: p.y };
- 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)`;
// } else if (current && s.collision) {
// console.log("2222222222222222222222222222222");
@@ -1193,8 +1185,9 @@ function updateShip(s, elapsed) {
} else {
// console.log("33333333333333333333333333333");
s.position = { x: p.x, y: p.y };
- 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)`;
}
+ return s.position;
}
function updateEdges(position) {
@@ -1289,7 +1282,10 @@ function animate(timestamp) {
frameCount++;
}
- updateShip(s, elapsed);
+ const newPos = updateShip(s, elapsed);
+
+ // s.node.style.transform = `translate(${s.position.x}px, ${s.position.y}px)`;
+
// Move.update(Ships[0], elapsed);
Ships.forEach(({ entity_id }) => {
// Acceleration[entity_id] = zeroP;
@@ -1298,6 +1294,9 @@ function animate(timestamp) {
Move.update({ entity_id }, elapsed);
});
+ // s.node.style.transform = `translate(${newPos.x}px, ${newPos.y}px)`;
+ s.node.style.transform = `translate(${Position[Ships[0].entity_id].x}px, ${Position[Ships[0].entity_id].y}px)`;
+
positionEl.innerText = `${Position[Ships[0].entity_id].x.toFixed(1)},${Position[Ships[0].entity_id].y.toFixed(1)}`;
// updateEdges(position);