I decided to create a game called Slinky Untangle. I chose to use Matter.JS, Executing the code, I get this
TypeError: Cannot read properties of undefined (reading 'create') at /script.js:12:21
Here is my code.
let Engine
x=document.createElement("script");x.src="https://github.com/liabru/matter-js/raw/master/build/matter.js"; document.head.appendChild(x);
var slinky = slinky || {};
slinky.wiggle = function() {
Engine = slinky.Engine;
Render = slinky.Render;
Body = slinky.Body;
MouseConstraint =
slinky.MouseConstraint
};
var engine = Engine.create(),
world = engine.world;
var render = Render.create({
element: document.body,
engine: engine,
options: {
width: 800,
height: 600,
wireframes: false
}
});
I am quite new to JavaScript although I known it a lot.