briochemc

tagpro stream example

Aug 6th, 2014
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name          Oceanic_Contenders_Stream_light
  3. // @namespace     http://www.reddit.com/user/NewCompte
  4. // @description   Rotating Transparent Jerseys on ungridded light brioche texture pack
  5. // @include       http://*.koalabeast.com:*
  6. // @license       GPL
  7. // @author        NewCompte, modified by brioche
  8. // @version       1
  9. // ==/UserScript==
  10.  
  11. // set team jersesy for the right color HERE    \
  12. // Ball Hits For Jesus v Mind The Cap = 7 vs 4   | <----------------------- I N P U T   H E R E  - the 2 numbers below to be exact
  13. // Balls Hits For Jesus v Lame Balls = 7 vs 0   /
  14. blueTeamJerseyIndex = 7                  
  15. redTeamJerseyIndex = 0
  16.  
  17. function myRotatingBallsScript() {
  18.     tagpro.ready(function(){
  19.         //This is important.
  20.         if(tagpro.events.drawPlayer)
  21.             return;
  22.        
  23.         // Jerseys
  24.         var jerseys = new Image();
  25.         jerseys.src = "http://i.imgur.com/tK6VQvt.png";
  26.        
  27.         // brioche light no grid and no balls
  28.         document.getElementById("tiles").src = "http://i.imgur.com/uuwrGYo.png";
  29.         document.getElementById("splats").src = "http://i.imgur.com/8g6gEF3.png";
  30.         document.getElementById("speedpad").src = "http://i.imgur.com/0fVV3Pl.png";
  31.         document.getElementById("speedpadred").src = "http://i.imgur.com/UzZs1Xb.png";
  32.         document.getElementById("speedpadblue").src = "http://i.imgur.com/LGqltmX.png";
  33.         document.getElementById("portal").src = "http://i.imgur.com/jJFGxcs.png";
  34.  
  35.         tagpro.events.register({
  36.             drawPlayer: function(player, context, drawPos, TILESIZE) {
  37.                 context.save();
  38.                 context.translate(drawPos.x + (TILESIZE / 2) * (1 / tagpro.zoom), drawPos.y + (TILESIZE / 2) * (1 / tagpro.zoom));
  39.                 context.rotate(player.angle)
  40.                 context.translate(-drawPos.x - (TILESIZE / 2) * (1 / tagpro.zoom), -drawPos.y - (TILESIZE / 2) * (1 / tagpro.zoom));
  41.                
  42.                 if (player.team == 1)
  43.                 context.drawImage(jerseys, redTeamJerseyIndex * 40, 40, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  44.                 if (player.team == 2)
  45.                 context.drawImage(jerseys, blueTeamJerseyIndex * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  46.                
  47.                 tagpro.tiles.drawWithZoom(context, player.team == 1 ? "redball" : "blueball", drawPos);
  48.  
  49.                 if (player.bomb && Math.round(Math.random() * 4) == 1) {
  50.                     context.fillStyle = "rgba(255, 255, 0, .60)";
  51.                     context.beginPath();
  52.                     context.arc(drawPos.x + (TILESIZE / 2) * (1 / tagpro.zoom), drawPos.y + (TILESIZE / 2) * (1 / tagpro.zoom), 17  * (1 / tagpro.zoom), 0, Math.PI*2, true);
  53.                     context.closePath();
  54.                     context.fill();
  55.                 };
  56.  
  57.                 if (player.tagpro) {
  58.                     context.strokeStyle = "#00FF00";
  59.                     context.fillStyle = "rgba(0, 255, 0, .20)";
  60.                     context.lineWidth = 2 * (1 / tagpro.zoom);
  61.                     context.beginPath();
  62.                     context.arc(drawPos.x + (TILESIZE / 2) * (1 / tagpro.zoom), drawPos.y + (TILESIZE / 2) * (1 / tagpro.zoom), 16  * (1 / tagpro.zoom), 0, Math.PI*2, true);
  63.                     context.closePath();
  64.                     if (!player.bomb)
  65.                         context.fill();
  66.                     context.stroke();
  67.                 }
  68.  
  69.                 context.restore();
  70.             }
  71.         });
  72.     });
  73. }
  74.  
  75. var source = "("+ myRotatingBallsScript + ")()";
  76. var script = document.createElement('script');
  77. script.setAttribute("type", "application/javascript");
  78. script.textContent = source;
  79.  
  80. document.body.appendChild(script);
Add Comment
Please, Sign In to add comment