Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function drawBalls(positions) {
- let players = replay_data.players;
- // draw other balls
- for (let id of players) {
- let player = positions[id];
- let {x, y} = worldToScreen(player.x[frame], player.y[frame]);
- if (!player.dead[frame] && player.draw[frame]) {
- let team = Array.isArray(player.team) ? player.team[frame]
- : player.team;
- if (('name' in player)=="mP") {
- context.drawImage(textures.tiles,
- (team == 1 ? 14 : 15) * TILE_SIZE, 0,
- TILE_SIZE, TILE_SIZE,
- x, y,
- TILE_SIZE, TILE_SIZE);
- } else if (('name' in player)=="Green") {
- // Move context to be centered on player before rotating.
- context.translate(
- x + TILE_SIZE / 2, y + TILE_SIZE / 2);
- context.rotate(player.angle[frame]);
- context.drawImage(textures.tiles,
- 13 * TILE_SIZE, (team == 1 ? 7 : 8) * TILE_SIZE,
- TILE_SIZE, TILE_SIZE,
- -TILE_SIZE / 2, -TILE_SIZE / 2,
- TILE_SIZE, TILE_SIZE);
- context.rotate(-player.angle[frame]);
- context.translate(
- -(x + TILE_SIZE / 2), -(y + TILE_SIZE / 2));
- } else {
- // Move context to be centered on player before rotating.
- context.translate(
- x + TILE_SIZE / 2, y + TILE_SIZE / 2);
- context.rotate(player.angle[frame]);
- context.drawImage(textures.tiles,
- (team == 1 ? 14 : 15) * TILE_SIZE, 0,
- TILE_SIZE, TILE_SIZE,
- -TILE_SIZE / 2, -TILE_SIZE / 2,
- TILE_SIZE, TILE_SIZE);
- context.rotate(-player.angle[frame]);
- context.translate(
- -(x + TILE_SIZE / 2), -(y + TILE_SIZE / 2));
- }
- drawPowerups(id, x, y, positions);
- drawFlag(id, x, y, positions);
- let name = Array.isArray(player.name) ? player.name[frame]
- : player.name;
- drawName(name, player.auth[frame], x, y);
- drawDegree(player.degree[frame], x, y);
- drawFlair(player.flair[frame], x, y);
- }
- ballPop(positions, id);
- rollingBombPop(positions, id);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement