Modify terrain and remove buttons
This commit is contained in:
@@ -59,7 +59,7 @@
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<polygon id="wall" points="-20,-20 -20,-30 30,-30 30,30 -10,40 -20,30 20,20 20,-20" />
|
||||
<polygon id="wall" points="-20,-30 -10,-40 30,-50 60,-30 80,0 150,0 150,10 60,50 -10,40 -20,20 20,20 20,-20" />
|
||||
<!-- <rect id="rect1" x="30" y="30" width="20" height="20"/> -->
|
||||
<g id="lines">
|
||||
</g>
|
||||
@@ -72,13 +72,13 @@
|
||||
<span id="fps" xmlns="http://www.w3.org/1999/xhtml">0</span> fps
|
||||
</div>
|
||||
|
||||
<button id="turn-left" xmlns="http://www.w3.org/1999/xhtml">🡐</button>
|
||||
<button id="move-backward" xmlns="http://www.w3.org/1999/xhtml">🡑</button>
|
||||
<button id="move-forward" xmlns="http://www.w3.org/1999/xhtml">🡓</button>
|
||||
<button id="turn-right" xmlns="http://www.w3.org/1999/xhtml">🡒</button>
|
||||
<button id="rotate-ccw" xmlns="http://www.w3.org/1999/xhtml">⟲</button>
|
||||
<button id="rotate-cw" xmlns="http://www.w3.org/1999/xhtml">⟳</button>
|
||||
<button id="fire" xmlns="http://www.w3.org/1999/xhtml">Fire</button>
|
||||
<!-- <button id="turn-left" xmlns="http://www.w3.org/1999/xhtml">🡐</button> -->
|
||||
<!-- <button id="move-backward" xmlns="http://www.w3.org/1999/xhtml">🡑</button> -->
|
||||
<!-- <button id="move-forward" xmlns="http://www.w3.org/1999/xhtml">🡓</button> -->
|
||||
<!-- <button id="turn-right" xmlns="http://www.w3.org/1999/xhtml">🡒</button> -->
|
||||
<!-- <button id="rotate-ccw" xmlns="http://www.w3.org/1999/xhtml">⟲</button> -->
|
||||
<!-- <button id="rotate-cw" xmlns="http://www.w3.org/1999/xhtml">⟳</button> -->
|
||||
<!-- <button id="fire" xmlns="http://www.w3.org/1999/xhtml">Fire</button> -->
|
||||
<pre id="debug" xmlns="http://www.w3.org/1999/xhtml"></pre>
|
||||
</foreignObject>
|
||||
|
||||
@@ -168,14 +168,17 @@
|
||||
|
||||
const pos = `${positionX},${positionY}`;
|
||||
const cwOrientation = det < 0;
|
||||
const isClockwise = det < 0;
|
||||
|
||||
if (pos !== attr.pop()) {
|
||||
attr.push(pos);
|
||||
t.setAttribute('points', attr.join(delim));
|
||||
}
|
||||
|
||||
t.classList[cwOrientation ? "add" : "remove"](className);
|
||||
if (cwOrientation) visible.push(t);
|
||||
t.classList[isClockwise ? "add" : "remove"](className);
|
||||
if (isClockwise) visible.push(t);
|
||||
|
||||
// return isClockwise ? [t, ...acc] : acc;
|
||||
// i think i can also discard obtuse triangles?
|
||||
|
||||
// if all the triangles are obtuse, i only need to check the nearest corner for a collision
|
||||
@@ -527,58 +530,58 @@
|
||||
}
|
||||
});
|
||||
|
||||
leftTurnButton.addEventListener("mousedown", function (e) {
|
||||
acceleration[0] = -force;
|
||||
});
|
||||
|
||||
leftTurnButton.addEventListener("mouseup", function (e) {
|
||||
acceleration[0] = 0;
|
||||
});
|
||||
|
||||
rightTurnButton.addEventListener("mousedown", function (e) {
|
||||
acceleration[0] = force;
|
||||
});
|
||||
|
||||
rightTurnButton.addEventListener("mouseup", function (e) {
|
||||
acceleration[0] = 0;
|
||||
});
|
||||
|
||||
reverseMoveButton.addEventListener("mousedown", function (e) {
|
||||
acceleration[1] = -force;
|
||||
});
|
||||
|
||||
reverseMoveButton.addEventListener("mouseup", function (e) {
|
||||
acceleration[1] = 0;
|
||||
});
|
||||
|
||||
forwardMoveButton.addEventListener("mousedown", function (e) {
|
||||
acceleration[1] = force;
|
||||
});
|
||||
|
||||
forwardMoveButton.addEventListener("mouseup", function (e) {
|
||||
acceleration[1] = 0;
|
||||
});
|
||||
|
||||
rotateCWButton.addEventListener("mousedown", function (e) {
|
||||
rotate = 1;
|
||||
});
|
||||
|
||||
rotateCWButton.addEventListener("mouseup", function (e) {
|
||||
rotate = 0;
|
||||
});
|
||||
|
||||
rotateCCWButton.addEventListener("mousedown", function (e) {
|
||||
rotate = -1;
|
||||
});
|
||||
|
||||
rotateCCWButton.addEventListener("mouseup", function (e) {
|
||||
rotate = 0;
|
||||
});
|
||||
|
||||
fireButton.addEventListener("click", function (e) {
|
||||
const [x, y] = getTranslate(hitbox);
|
||||
fireBullet(x, y, velocity);
|
||||
});
|
||||
// leftTurnButton.addEventListener("mousedown", function (e) {
|
||||
// acceleration[0] = -force;
|
||||
// });
|
||||
//
|
||||
// leftTurnButton.addEventListener("mouseup", function (e) {
|
||||
// acceleration[0] = 0;
|
||||
// });
|
||||
//
|
||||
// rightTurnButton.addEventListener("mousedown", function (e) {
|
||||
// acceleration[0] = force;
|
||||
// });
|
||||
//
|
||||
// rightTurnButton.addEventListener("mouseup", function (e) {
|
||||
// acceleration[0] = 0;
|
||||
// });
|
||||
//
|
||||
// reverseMoveButton.addEventListener("mousedown", function (e) {
|
||||
// acceleration[1] = -force;
|
||||
// });
|
||||
//
|
||||
// reverseMoveButton.addEventListener("mouseup", function (e) {
|
||||
// acceleration[1] = 0;
|
||||
// });
|
||||
//
|
||||
// forwardMoveButton.addEventListener("mousedown", function (e) {
|
||||
// acceleration[1] = force;
|
||||
// });
|
||||
//
|
||||
// forwardMoveButton.addEventListener("mouseup", function (e) {
|
||||
// acceleration[1] = 0;
|
||||
// });
|
||||
//
|
||||
// rotateCWButton.addEventListener("mousedown", function (e) {
|
||||
// rotate = 1;
|
||||
// });
|
||||
//
|
||||
// rotateCWButton.addEventListener("mouseup", function (e) {
|
||||
// rotate = 0;
|
||||
// });
|
||||
//
|
||||
// rotateCCWButton.addEventListener("mousedown", function (e) {
|
||||
// rotate = -1;
|
||||
// });
|
||||
//
|
||||
// rotateCCWButton.addEventListener("mouseup", function (e) {
|
||||
// rotate = 0;
|
||||
// });
|
||||
//
|
||||
// fireButton.addEventListener("click", function (e) {
|
||||
// const [x, y] = getTranslate(hitbox);
|
||||
// fireBullet(x, y, velocity);
|
||||
// });
|
||||
//]]></script>
|
||||
</svg>
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 18 KiB |
Reference in New Issue
Block a user