mirror of
https://github.com/mat-1/matdoesdev.git
synced 2025-08-02 14:46:04 +00:00
add walls
This commit is contained in:
parent
029f8eb796
commit
ca8d62fb03
2 changed files with 17 additions and 2 deletions
|
@ -20,7 +20,22 @@ export function initGravity(): () => void {
|
|||
isStatic: true,
|
||||
}
|
||||
)
|
||||
Composite.add(engine.world, [floorBody])
|
||||
const rightWallBody = Bodies.rectangle(
|
||||
window.innerWidth + 50,
|
||||
window.innerHeight / 2,
|
||||
100,
|
||||
window.innerHeight,
|
||||
{
|
||||
isStatic: true,
|
||||
}
|
||||
)
|
||||
const leftWallBody = Bodies.rectangle(-50, window.innerHeight / 2, 100, window.innerHeight, {
|
||||
isStatic: true,
|
||||
})
|
||||
const ceilingBody = Bodies.rectangle(window.innerWidth / 2, -50, window.innerWidth, 100, {
|
||||
isStatic: true,
|
||||
})
|
||||
Composite.add(engine.world, [floorBody, rightWallBody, leftWallBody, ceilingBody])
|
||||
|
||||
const trackedElements = new Map<HTMLElement, Matter.Body>()
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
pathChangeTimestamps.push(Date.now())
|
||||
while (pathChangeTimestamps[0] < Date.now() - 5000) pathChangeTimestamps.shift()
|
||||
console.log(pathChangeTimestamps)
|
||||
if (pathChangeTimestamps.length >= 10) {
|
||||
if (pathChangeTimestamps.length >= 1) {
|
||||
const { initGravity } = await import('$lib/gravity')
|
||||
// wait 200ms for the animation to finish
|
||||
await new Promise((resolve) => setTimeout(resolve, 200))
|
||||
|
|
Loading…
Add table
Reference in a new issue