diff --git a/index.js b/index.js index bc5b03e..2838c33 100644 --- a/index.js +++ b/index.js @@ -14,16 +14,10 @@ let render = Render.create({ engine: engine, }); -// create two boxes and a ground -let boxA = Bodies.rectangle(400, 200, 80, 200); -let boxB = Bodies.rectangle(450, 50, 80, 80); -let triangle = Bodies.polygon(350, 200, 5, 80); -let ground = Bodies.rectangle(400, 610, 810, 60, { isStatic: true }); - function kaboom() { let manyShapes = new Array(300) - .fill({}) - .map((item) => + .fill() + .map(() => Bodies.polygon( Math.random() * 450 + 1, Math.random() * 450 + 1, @@ -32,14 +26,16 @@ function kaboom() { ) ); - console.log(manyShapes); - generateWorld(manyShapes); } +function addShape() { + // to be continued +} + function generateWorld(shapes) { // add all of the bodies to the world - // Composite.add(engine.world, [boxA, boxB, triangle, ground]); + let ground = Bodies.rectangle(400, 610, 810, 60, { isStatic: true }); Composite.add(engine.world, [...shapes, ground]); // run the renderer