const imgPlayer = new Image(); const imgBullet = new Image(); const imgCar = new Image(); imgPlayer.src = "./assets/body.png"; imgBullet.src = "./assets/bullet.png"; imgCar.src = "./assets/car.png"; class Render { constructor(id, mapsrc) { this.canvas = document.getElementById(id); this.ctx = canvas.getContext("2d"); this.players = []; this.bullets = []; this.mapsrc=mapsrc; this.ReloadAff(); this.playerid=0; } SetPlayerId(id) { this.playerid=id } AddPlayer(player) { this.players.push(player); } addBullet(bullet) { this.bullets.push(bullet); } remBullet(bullet) { for(let i=0;i { this.RenderPlayer(player); }) this.bullets.forEach((bullet) => { this.RenderBullet(bullet); }); } }