Files
mjs/666.ограничитель.js

40 lines
1.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function Ограничитель() {
this.создать = function()
{
this.ограничитель = null;
};
this.обновить = function()
{
if (this.ограничитель || !мир.игрок.тело)
{
return;
}
this.ограничитель = true;
this.создатьОграничитель();
};
this.создатьОграничитель = function()
{
var ф2 = {
isSensor: true,
isStatic: false,
inertia: Infinity,
density: 0.0000001,
};
var тело2 = Matter.Bodies.rectangle(1170, 350, 40, 40, ф2);
var x = мир.игрок.тело.position.x;
var y = мир.игрок.тело.position.y - 50;
Matter.Body.setPosition(тело2, { x: x, y: y });
//Matter.Body.setParts(мир.игрок.тело, [тело2]);
console.debug("создан compound");
//мир.игрок.тело.collisionFilter.mask = 1|2;
};
// Конструктор.
this.создать();
}