Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor({ io }) {
this.users = new UserCollection();
this.activeUsers = new UserCollection();
this.io = io;
this.engine = Engine.create();
this.frame = 0;
this.inputBuffer = new InputBuffer();
this.waitingQueue = new WaitingQueue();
this.gameIsRunning = false;
this.playerIds = {0: null, 1: null, 2: null, 3: null};
console.log('New ServerEngine created!')
}
initMatter() {
this.engine = Engine.create();
}
engageMusic(container: HTMLDivElement) {
const containerRectangle = container.getBoundingClientRect();
const height = containerRectangle.bottom - containerRectangle.top;
const engine = Engine.create({
render: {
element: container,
options: {
background: 'transparent',
wireframes: false,
width: window.innerWidth,
height,
},
},
});
const nrand = () => {
let x1;
let x2;
let rad;
do {
componentDidMount() {
this.matterEngine = Engine.create();
this.matterRender = Render.create({
canvas: this.element,
engine: this.matterEngine,
options: {
wireframes: false,
width: 300,
height: 300,
background: "transparent"
}
});
this.showBurger();
}
componentDidUpdate() {
constructor(props) {
super(props);
this.loopID = null;
this.lastTime = null;
const world = Matter.World.create({ gravity: props.gravity });
this.engine = Engine.create({
world,
});
this.loop = this.loop.bind(this);
}
constructor(props) {
super(props);
this.loopID = null;
this.lastTime = null;
const world = Matter.World.create({ gravity: props.gravity });
this.engine = Engine.create({
world,
});
this.loop = this.loop.bind(this);
}
socket.on('start game', () => {
this.activeUsers.broadcastAll('start game');
this.users.broadcastAll('game started');
this.engine = Engine.create();
this.createEnvironment();
this.registerPhysicsEvents();
setTimeout(() => {
this.activeUsers.broadcastAll('START');
this.startGame();
}, 5000);
});
onInit (options: any) {
this.state = new GameState();
this.setState(this.state);
this.engine = Engine.create();
this.engine.world.gravity.scale = 0;
this.createWalls();
Events.on(this.engine, "collisionStart", this.onCollisionStart.bind(this));
Events.on(this.engine, "collisionEnd", this.onCollisionStart.bind(this));
this.setSimulationInterval(this.update.bind(this));
this.clock.setInterval(this.broadcastAllEntityIds.bind(this), 3000);
}