some
This commit is contained in:
@@ -30,14 +30,14 @@
|
|||||||
|
|
||||||
|
|
||||||
мир.игрок.обновить = function() {
|
мир.игрок.обновить = function() {
|
||||||
мир.игрок.тело = мир.объекты.тела[мир.игрок.задано.объект];
|
/**///мир.игрок.тело = мир.объекты.тела[мир.игрок.задано.объект];
|
||||||
|
мир.игрок.тело = мир.рт.тело;
|
||||||
if (!мир.игрок.тело)
|
if (!мир.игрок.тело)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
мир.игрок.переместить();
|
мир.игрок.переместить();
|
||||||
//мир.игрок.задатьМаскуСтолкновения();
|
|
||||||
мир.игрок.отслеживатьПрыжкиПриземления();
|
мир.игрок.отслеживатьПрыжкиПриземления();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
function РучноеТело(события) {
|
function РучноеТело(события) {
|
||||||
this.создать = function() {
|
this.создать = function() {
|
||||||
события.подписать(this);
|
//события.подписать(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
this.обработатьСобытие = function(событие) {
|
this.обработатьСобытие = function(событие) {
|
||||||
if (событие != "игрок начал прыжок")
|
if (событие != "игрок начал прыжок")
|
||||||
{
|
{
|
||||||
@@ -11,16 +12,25 @@ function РучноеТело(события) {
|
|||||||
события.отписать(this);
|
события.отписать(this);
|
||||||
this.настроить();
|
this.настроить();
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
this.настроить = function()
|
this.настроить = function()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
if (!мир.физика.движок)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if (this.настроено)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.настроено = true;
|
||||||
|
|
||||||
var физика = {
|
|
||||||
inertia: Infinity,
|
|
||||||
};
|
|
||||||
// 1.
|
// 1.
|
||||||
this.тело1 = Matter.Bodies.rectangle(1200, 300, 40, 40, физика);
|
this.тело1 = Matter.Bodies.rectangle(125, 300, 40, 40, { isSensor: true });
|
||||||
Matter.Composite.add(мир.физика.движок.world, this.тело1);
|
//Matter.Composite.add(мир.физика.движок.world, this.тело1);
|
||||||
|
|
||||||
this.элемент1 = document.createElement("div");
|
this.элемент1 = document.createElement("div");
|
||||||
document.getElementById("корень").appendChild(this.элемент1);
|
document.getElementById("корень").appendChild(this.элемент1);
|
||||||
@@ -30,10 +40,11 @@ function РучноеТело(события) {
|
|||||||
this.элемент1.style.width = `40px`;
|
this.элемент1.style.width = `40px`;
|
||||||
this.элемент1.style.height = `40px`;
|
this.элемент1.style.height = `40px`;
|
||||||
this.элемент1.style.setProperty("background", "url(р/отладка/основа.jpg)");
|
this.элемент1.style.setProperty("background", "url(р/отладка/основа.jpg)");
|
||||||
|
this.элемент1.style.setProperty("z-index", "100");
|
||||||
|
|
||||||
// 2.
|
// 2.
|
||||||
this.тело2 = Matter.Bodies.rectangle(1150, 300, 40, 40, физика);
|
this.тело2 = Matter.Bodies.rectangle(55, 300, 40, 40, {});
|
||||||
Matter.Composite.add(мир.физика.движок.world, this.тело2);
|
//Matter.Composite.add(мир.физика.движок.world, this.тело2);
|
||||||
|
|
||||||
this.элемент2 = document.createElement("div");
|
this.элемент2 = document.createElement("div");
|
||||||
document.getElementById("корень").appendChild(this.элемент2);
|
document.getElementById("корень").appendChild(this.элемент2);
|
||||||
@@ -43,11 +54,20 @@ function РучноеТело(события) {
|
|||||||
this.элемент2.style.width = `40px`;
|
this.элемент2.style.width = `40px`;
|
||||||
this.элемент2.style.height = `40px`;
|
this.элемент2.style.height = `40px`;
|
||||||
this.элемент2.style.setProperty("background", "url(р/отладка/основа.jpg)");
|
this.элемент2.style.setProperty("background", "url(р/отладка/основа.jpg)");
|
||||||
|
this.элемент2.style.setProperty("z-index", "100");
|
||||||
|
|
||||||
|
// Compound.
|
||||||
|
this.тело = Matter.Body.create({
|
||||||
|
parts: [this.тело1, this.тело2],
|
||||||
|
inertia: Infinity,
|
||||||
|
});
|
||||||
|
Matter.Composite.add(мир.физика.движок.world, this.тело);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.обновить = function()
|
this.обновить = function()
|
||||||
{
|
{
|
||||||
if (!this.тело1)
|
this.настроить();
|
||||||
|
if (!this.тело)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,6 +136,7 @@
|
|||||||
скорость: [5, 12.5],
|
скорость: [5, 12.5],
|
||||||
клавиши: ["ArrowLeft", "ArrowRight", "ArrowUp"],
|
клавиши: ["ArrowLeft", "ArrowRight", "ArrowUp"],
|
||||||
},
|
},
|
||||||
|
/*
|
||||||
слежение: {
|
слежение: {
|
||||||
колобок: {
|
колобок: {
|
||||||
объект: "кирпич",
|
объект: "кирпич",
|
||||||
@@ -155,6 +156,7 @@
|
|||||||
маски: [1, 1|2],
|
маски: [1, 1|2],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
звуки: {
|
звуки: {
|
||||||
прыжокИгрока: {
|
прыжокИгрока: {
|
||||||
события: ["игрок начал прыжок"],
|
события: ["игрок начал прыжок"],
|
||||||
|
|||||||
Reference in New Issue
Block a user