Guest User

TagPro Pro w/ consistent coloring

a guest
Jul 7th, 2014
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. // ==UserScript==
  2. // @name TagPro Pro
  3. // @namespace http://www.reddit.com/user/CumFlakes
  4. // @description Rotating Balls, pixel perfect power-ups.
  5. // @include http://*.koalabeast.com*
  6. // @include http://*.jukejuice.com*
  7. // @include http://*.newcompte.fr*
  8. // @include http://justletme.be*
  9. // @license GPL
  10. // @author NewCompte, Ly, Cumflakes.
  11. // @version 1
  12. // ==/UserScript==
  13. function myRotatingBallsScript() {
  14. tagpro.ready(function(){
  15. if(tagpro.events.drawPlayer)
  16. return;
  17. var image = new Image();
  18. image.src = "http://i.imgur.com/K9SbmSz.png";
  19. document.getElementById("tiles").src = "http://i.imgur.com/HiZYdww.png";
  20. document.getElementById("splats").src = "http://lejdesigns.com/splats.png";
  21. document.getElementById("speedpad").src = "http://i.imgur.com/HTCSHhe.png";
  22. document.getElementById("speedpadred").src = "http://i.imgur.com/UarfAlB.png";
  23. document.getElementById("speedpadblue").src = "http://i.imgur.com/R7Qvfgg.png";
  24. document.getElementById("portal").src = "http://i.imgur.com/BEr4T9e.png";
  25. tagpro.events.register({
  26. drawPlayer: function(player, context, drawPos, TILESIZE) {
  27. context.save();
  28. context.translate(drawPos.x + (TILESIZE / 2) * (1 / tagpro.zoom), drawPos.y + (TILESIZE / 2) * (1 / tagpro.zoom));
  29. context.rotate(player.angle)
  30. context.translate(-drawPos.x - (TILESIZE / 2) * (1 / tagpro.zoom), -drawPos.y - (TILESIZE / 2) * (1 / tagpro.zoom));
  31. tagpro.tiles.drawWithZoom(context, player.team == 1 ? "redball" : "blueball", drawPos);
  32. context.restore();
  33.  
  34.  
  35. ///ADDED IF THEN STATEMENT HERE
  36. if (tagpro.switchedColors) {
  37. if (player.team == 2)
  38. context.drawImage(image, 0 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  39. if (player.team == 1)
  40. context.drawImage(image, 1 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  41. } else {
  42. if (player.team == 1)
  43. context.drawImage(image, 0 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  44. if (player.team == 2)
  45. context.drawImage(image, 1 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  46.  
  47. }
  48.  
  49. if (player.bomb && Math.round(Math.random() * 4) == 1) {
  50. context.fillStyle = "rgba(255, 255, 0, .50)";
  51. context.beginPath();
  52. context.arc(drawPos.x + (TILESIZE / 2) * (1 / tagpro.zoom), drawPos.y + (TILESIZE / 2) * (1 / tagpro.zoom), 19 * (1 / tagpro.zoom), 0, Math.PI*2, true);
  53. context.closePath();
  54. context.fill();
  55. };
  56. if (player.tagpro) {
  57. context.strokeStyle = "rgba(0, 255, 0, .80)";
  58. context.fillStyle = "rgba(0, 255, 0, .25)";
  59. context.lineWidth = 3 * (1 / tagpro.zoom);
  60. context.beginPath();
  61. context.arc(drawPos.x + (TILESIZE / 2) * (1 / tagpro.zoom), drawPos.y + (TILESIZE / 2) * (1 / tagpro.zoom), 18 * (1 / tagpro.zoom), 0, Math.PI*2, true);
  62. context.closePath();
  63. if (!player.bomb)
  64. context.fill();
  65. context.stroke();
  66. }
  67. }
  68. });
  69. });
  70. }
  71. var source = "("+ myRotatingBallsScript + ")()";
  72. var script = document.createElement('script');
  73. script.setAttribute("type", "application/javascript");
  74. script.textContent = source;
  75. document.body.appendChild(script);
Add Comment
Please, Sign In to add comment