- add gamepad for play on mobile
    - merge
This commit is contained in:
Kum1ta
2024-09-27 21:16:53 +02:00
parent 9650f0d390
commit 7d319d020b
9 changed files with 181 additions and 31 deletions

View File

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* Map.js :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hubourge <hubourge@student.42.fr> +#+ +:+ +#+ */
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/20 14:52:55 by hubourge #+# #+# */
/* Updated: 2024/09/27 18:21:20 by hubourge ### ########.fr */
/* Updated: 2024/09/27 21:15:45 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -812,40 +812,31 @@ class Map
}, 10);
};
listObject = null;
placeObject(listObject)
{
let nbJumper = 0;
listObject = listObject.content;
for (let i = 0; i < listObject.length; i++ )
this.listObject = listObject.content;
for (let i = 0; i < this.listObject.length; i++ )
{
if (listObject[i].type == 1)
if (this.listObject[i].type == 1)
{
this.#createGravityChanger(listObject[i].pos.x, listObject[i].pos.y, listObject[i].pos.z, listObject[i].name, listObject[i].isUp ? "jumperTop" : "jumperBottom", listObject[i].isUp);
this.#createGravityChanger(listObject[i].pos.x, listObject[i].pos.y, listObject[i].pos.z, "gravityChanger" + i, listObject[i].isUp ? "jumperTop" : "jumperBottom", listObject[i].isUp);
nbJumper++;
}
else if (listObject[i].type == 2)
scene.add(this.#createWallObstacle(listObject[i].pos.x, listObject[i].pos.y, listObject[i].pos.z, listObject[i].isUp));
else if (this.listObject[i].type == 2)
scene.add(this.#createWallObstacle(this.listObject[i].pos.x, this.listObject[i].pos.y, this.listObject[i].pos.z, this.listObject[i].isUp));
}
}
activeJumper(name)
{
ball.changeGravity();
for (let i = 0; this.arrObject && i < this.arrObject.length; i++)
{
console.log("/////////////");
console.log(this.arrObject[i].name);
console.log(name);
console.log("/////////////");
if (this.arrObject[i].name == name)
{
if (this.arrObject[i].name == "jumperTop")
this.#animationGravityChanger(this.arrObject[i].mesh, true);
else
this.#animationGravityChanger(this.arrObject[i].mesh, false);
}
}
if (this.listObject[index].isUp)
this.#animationGravityChanger(this.listObject[index].mesh, true);
else
this.#animationGravityChanger(this.listObject[index].mesh, false);
}
#generateObstacle()