game: player control the right paddle

This commit is contained in:
starnakin 2024-01-17 14:52:39 +01:00
parent 3dc07803eb
commit f5b2c01633

View File

@ -77,11 +77,7 @@ export default class extends AbstractView
document.getElementById("app").appendChild(canva); document.getElementById("app").appendChild(canva);
this.register_key() let index = this.game.players.findIndex((player) => player.id === client.me.id);
this.render_game();
let index = this.game.players.findIndex((player) => player.id);
if (index !== -1) if (index !== -1)
{ {
let my_player = this.game.players[index]; let my_player = this.game.players[index];
@ -96,6 +92,10 @@ export default class extends AbstractView
); );
this.game.players[index] = this.my_player; this.game.players[index] = this.my_player;
} }
this.register_key()
this.render_game();
} }
async update_game_state() async update_game_state()