WIP: on landing; on collision, color only local wall
This commit is contained in:
@@ -745,7 +745,7 @@ function updateShip(s, elapsed) {
|
||||
|
||||
// const baseSlope = slope(s.collision.edge);
|
||||
// if (Object.is(baseSlope, 0) && s.gearDown) s.isLanded = true;
|
||||
s.isLanded = true;
|
||||
// s.isLanded = true;
|
||||
let posP;
|
||||
if (s.collision.corner) {
|
||||
posP = cornerContactPosition(p.x, p.y, px, py, s.collision.corner, shipRadius);
|
||||
@@ -840,7 +840,7 @@ function init() {
|
||||
started = false;
|
||||
const mult = 10000;
|
||||
|
||||
s.position = { x: 0, y: 0 };
|
||||
s.position = { x: 10, y: 10 };
|
||||
s.velocity = { x: 0, y: 0 };
|
||||
|
||||
// s. velocity = { x: 2*mult, y: 7*mult };
|
||||
@@ -894,8 +894,7 @@ function animate(timestamp) {
|
||||
if (s.collision && !s.isLanded) {
|
||||
started = false;
|
||||
isReadingKeys = false;
|
||||
wallElements.forEach(w => w.setAttribute('fill', 'red'));
|
||||
// bg.style.fill = 'red';
|
||||
s.collision.wall.node.setAttribute('fill', 'red');
|
||||
}
|
||||
|
||||
if (restart) {
|
||||
|
||||
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Reference in New Issue
Block a user