WIP: on landing; on collision, color only local wall

This commit is contained in:
2026-01-08 11:05:20 -08:00
parent 4fd9688d53
commit da2b1d9a6f

View File

@@ -745,7 +745,7 @@ function updateShip(s, elapsed) {
// const baseSlope = slope(s.collision.edge); // const baseSlope = slope(s.collision.edge);
// if (Object.is(baseSlope, 0) && s.gearDown) s.isLanded = true; // if (Object.is(baseSlope, 0) && s.gearDown) s.isLanded = true;
s.isLanded = true; // s.isLanded = true;
let posP; let posP;
if (s.collision.corner) { if (s.collision.corner) {
posP = cornerContactPosition(p.x, p.y, px, py, s.collision.corner, shipRadius); posP = cornerContactPosition(p.x, p.y, px, py, s.collision.corner, shipRadius);
@@ -840,7 +840,7 @@ function init() {
started = false; started = false;
const mult = 10000; const mult = 10000;
s.position = { x: 0, y: 0 }; s.position = { x: 10, y: 10 };
s.velocity = { x: 0, y: 0 }; s.velocity = { x: 0, y: 0 };
// s. velocity = { x: 2*mult, y: 7*mult }; // s. velocity = { x: 2*mult, y: 7*mult };
@@ -894,8 +894,7 @@ function animate(timestamp) {
if (s.collision && !s.isLanded) { if (s.collision && !s.isLanded) {
started = false; started = false;
isReadingKeys = false; isReadingKeys = false;
wallElements.forEach(w => w.setAttribute('fill', 'red')); s.collision.wall.node.setAttribute('fill', 'red');
// bg.style.fill = 'red';
} }
if (restart) { if (restart) {

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB