GrandTabernacleAutoVI/js/game.js
2023-11-29 17:06:30 +01:00

28 lines
No EOL
669 B
JavaScript

Renderer = new Render("canvas", "./assets/map/map7_recadr.png");
let Net = new Network("ws://129.151.227.50:8080/", Renderer);
//let ClientKeyboard = new Keyboard()
Inp = new Input("canvas");
let playerId;
let players = []
function game() {
for (var i = players.length - 1; i >= 0; i--) {
players[i].update([],[]);
}
//console.log(Inp.calculateAngle(500,500))
Renderer.ReloadAff();
}
function Start() {
playerId = Net.getPlayerId(); //id of client player
//Net.getPlayersToAdd.forEach((Player) => players[Player[id]] = Player)
setInterval(game)
}
Net.onready = Start();
Net.connect(); //connect to server, create a player, and retrieve all players info