class GameConfig { /** * @param {Client} client */ constructor(client) { /** * @type {Client} */ this.client = client; } async init() { let response = await this.client._get("/api/games/"); if (response.status !== 200) return response.status; let response_data = await response.json(); this.size_x = response_data.MAP_SIZE_X; this.size_y = response_data.MAP_SIZE_Y; this.center_x = this.size_x / 2; this.center_y = this.size_y / 2; this.paddle_ratio = response_data.PADDLE_RATIO; this.paddle_speed_per_second_max = response_data.PADDLE_SPEED_PER_SECOND_MAX; this.wall_ratio = response_data.WALL_RATIO; this.ball_speed_inc = response_data.BALL_SPEED_INC; this.ball_speed_start = response_data.BALL_SPEED_START; this.ball_size = response_data.BALL_SIZE; this.ball_spawn_x = this.center_x; this.ball_spawn_y = this.center_y; return 0; } } export { GameConfig }