import { Player } from "./Player.js"; class MyPlayer extends Player { constructor(client, pos, nb_goal, game, time) { super(client.me.id, pos, nb_goal, game); this.time = time; this.client = client; } update_paddle(keys_pressed) { let new_pos = this.pos; if (keys_pressed.includes("s")) new_pos -= this.game.config.paddle_speed_per_second_max * this.time.deltaTimeSecond(); if (keys_pressed.includes("w")) new_pos += this.game.config.paddle_speed_per_second_max * this.time.deltaTimeSecond(); new_pos = Math.max(0 + this.game.config.paddle_ratio / 2, new_pos); new_pos = Math.min(1 - this.game.config.paddle_ratio / 2, new_pos); this.pos = new_pos; this.game._send_paddle(this); } } export { MyPlayer }