Game
- force ball pos reset
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/09/13 13:59:46 by edbernar #+# #+# */
|
/* Created: 2024/09/13 13:59:46 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/11/15 15:08:44 by edbernar ### ########.fr */
|
/* Updated: 2024/11/15 15:26:47 by edbernar ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/08/20 17:02:47 by edbernar #+# #+# */
|
/* Created: 2024/08/20 17:02:47 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/11/13 22:16:05 by edbernar ### ########.fr */
|
/* Updated: 2024/11/15 15:41:01 by edbernar ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -134,7 +134,9 @@ class Ball
|
|||||||
this.start = performance.now()
|
this.start = performance.now()
|
||||||
let gameTime = performance.now() - this.start
|
let gameTime = performance.now() - this.start
|
||||||
if(content.game_time > gameTime)
|
if(content.game_time > gameTime)
|
||||||
this.start -= content.game_time - gameTime
|
this.start -= content.game_time - gameTime
|
||||||
|
if (content.velocity[0] == 0 && content.velocity[1] == 0)
|
||||||
|
this.object.position.set(content.pos[0], this.limits.down, content.pos[1]);
|
||||||
this.srvPos = {
|
this.srvPos = {
|
||||||
time : content.game_time,
|
time : content.game_time,
|
||||||
pos : [content.pos[0], content.pos[1]],
|
pos : [content.pos[0], content.pos[1]],
|
||||||
|
Reference in New Issue
Block a user