diff --git a/site/game/controls.js b/site/game/controls.js index de664f4..03c8f8e 100644 --- a/site/game/controls.js +++ b/site/game/controls.js @@ -3,24 +3,29 @@ /* ::: :::::::: */ /* controls.js :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: hubourge +#+ +:+ +#+ */ +/* By: edbernar +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/08/07 15:20:55 by hubourge #+# #+# */ -/* Updated: 2024/08/07 15:58:16 by hubourge ### ########.fr */ +/* Updated: 2024/08/07 16:19:53 by edbernar ### ########.fr */ /* */ /* ************************************************************************** */ +import { sendRequest } from "./websocket.js"; import * as THREE from 'three'; class Moves { wPress = false; sPress = false; constructor() {}; + + } class MoveObject { #moves = null; #object = null; + #speed = 0.1; + constructor(object) { let key = ['w', 's']; @@ -39,12 +44,6 @@ class MoveObject { document.addEventListener("keydown", (event) => { for (let i = 0; i < key.length; i++) { - if (event.key == '-') - { - console.log(this.moves.wPress); - console.log(this.moves.sPress); - return ; - } if (event.key == key[i]) { (movesValueDown[i])(); @@ -64,7 +63,19 @@ class MoveObject { }); }; - update() {}; + update() + { + if (this.moves.wPress) + { + this.object.position.z -= this.#speed; + sendRequest("playerMove", {x: this.object.position.x, y: this.object.position.y, z: this.object.position.z}); + } + if (this.moves.sPress) + { + this.object.position.z += this.#speed; + sendRequest("playerMove", {x: this.object.position.x, y: this.object.position.y, z: this.object.position.z}); + } + }; } export { MoveObject }; \ No newline at end of file diff --git a/site/game/light.js b/site/game/light.js index 3b4cc34..ca3c3f8 100644 --- a/site/game/light.js +++ b/site/game/light.js @@ -6,7 +6,7 @@ /* By: edbernar +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/30 13:50:46 by edbernar #+# #+# */ -/* Updated: 2024/07/30 13:50:47 by edbernar ### ########.fr */ +/* Updated: 2024/08/07 16:20:11 by edbernar ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/site/game/main.js b/site/game/main.js index ef43954..78ccede 100644 --- a/site/game/main.js +++ b/site/game/main.js @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* main.js :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: hubourge +#+ +:+ +#+ */ +/* By: edbernar +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/30 13:50:49 by edbernar #+# #+# */ -/* Updated: 2024/08/07 15:54:56 by hubourge ### ########.fr */ +/* Updated: 2024/08/07 16:21:01 by edbernar ### ########.fr */ /* */ /* ************************************************************************** */ @@ -78,6 +78,7 @@ function animate() { ball.position.x = Math.sin(Date.now() * 0.001) * 2; ball.position.z = Math.cos(Date.now() * 0.001) * 2; renderer.render(scene, camera); + controlBall.update(); stats.end(); } diff --git a/site/game/map.js b/site/game/map.js index eaf2888..cd2c71b 100644 --- a/site/game/map.js +++ b/site/game/map.js @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* map.js :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: hubourge +#+ +:+ +#+ */ +/* By: edbernar +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/30 13:50:51 by edbernar #+# #+# */ -/* Updated: 2024/08/07 15:34:12 by hubourge ### ########.fr */ +/* Updated: 2024/08/07 16:20:08 by edbernar ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/websocket-server/Class/__pycache__/User.cpython-310.pyc b/websocket-server/Class/__pycache__/User.cpython-310.pyc deleted file mode 100644 index 3d2c99d..0000000 Binary files a/websocket-server/Class/__pycache__/User.cpython-310.pyc and /dev/null differ diff --git a/websocket-server/typeRequets/__pycache__/getPrivateListMessage.cpython-310.pyc b/websocket-server/typeRequets/__pycache__/getPrivateListMessage.cpython-310.pyc deleted file mode 100644 index b5de488..0000000 Binary files a/websocket-server/typeRequets/__pycache__/getPrivateListMessage.cpython-310.pyc and /dev/null differ diff --git a/websocket-server/typeRequets/__pycache__/getPrivateListUser.cpython-310.pyc b/websocket-server/typeRequets/__pycache__/getPrivateListUser.cpython-310.pyc deleted file mode 100644 index 9f73101..0000000 Binary files a/websocket-server/typeRequets/__pycache__/getPrivateListUser.cpython-310.pyc and /dev/null differ diff --git a/websocket-server/typeRequets/__pycache__/login.cpython-310.pyc b/websocket-server/typeRequets/__pycache__/login.cpython-310.pyc deleted file mode 100644 index 479b869..0000000 Binary files a/websocket-server/typeRequets/__pycache__/login.cpython-310.pyc and /dev/null differ diff --git a/websocket-server/typeRequets/__pycache__/sendPrivateMessage.cpython-310.pyc b/websocket-server/typeRequets/__pycache__/sendPrivateMessage.cpython-310.pyc deleted file mode 100644 index c696138..0000000 Binary files a/websocket-server/typeRequets/__pycache__/sendPrivateMessage.cpython-310.pyc and /dev/null differ