Guest User

cf's marbles with cam's tiles

a guest
Jul 28th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. // ==UserScript==
  2. // @name TagPro Spin Marbles
  3. // @namespace http://www.reddit.com/user/CumFlakes
  4. // @description Marble spin effect.
  5. // @include http://*.koalabeast.com:*
  6. // @include http://*.jukejuice.com:*
  7. // @include http://*.newcompte.fr:*
  8. // @include http://justletme.be:*
  9. // @license 2014
  10. // @author Cflakes.
  11. // @version 1
  12. // ==/UserScript==
  13.  
  14. function MarblesScript() {
  15. tagpro.ready(function(){
  16. if(tagpro.events.drawPlayer)
  17. return;
  18. var spinBalls = new Image();
  19. spinBalls.src = "http://i.imgur.com/EFxpfsm.png";
  20. document.getElementById("tiles").src = "http://i.imgur.com/22NGRaG.png";
  21. document.getElementById("splats").src = "http://i.imgur.com/pJ3HlcS.png";
  22. document.getElementById("speedpad").src = "http://i.imgur.com/h873jWW.png";
  23. document.getElementById("speedpadred").src = "http://i.imgur.com/CABP3Ig.png";
  24. document.getElementById("speedpadblue").src = "http://i.imgur.com/EwDvvsm.png";
  25. document.getElementById("portal").src = "http://i.imgur.com/fxYJYFi.png";
  26. tagpro.events.register({
  27. drawPlayer: function(player, context, drawPos, TILESIZE) {
  28. var color = (player.team == 1) ? 0 : 1;
  29. var overColor = (player.team == 1) ? 2 : 3;
  30. context.drawImage(spinBalls, color * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  31. context.save();
  32. context.translate(drawPos.x + (TILESIZE / 2) * (1 / tagpro.zoom), drawPos.y + (TILESIZE / 2) * (1 / tagpro.zoom));
  33. context.rotate(player.angle);
  34. context.translate(-drawPos.x - (TILESIZE / 2) * (1 / tagpro.zoom), -drawPos.y - (TILESIZE / 2) * (1 / tagpro.zoom));
  35. context.drawImage(spinBalls, overColor * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom);
  36. context.restore();
  37. if (player.bomb && Math.round(Math.random() * 4) == 1) {
  38. context.fillStyle = "rgba(255, 255, 0, .50)";
  39. context.beginPath();
  40. 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);
  41. context.closePath();
  42. context.fill();
  43. };
  44. if (player.tagpro) {
  45. context.fillStyle = "rgba(0, 255, 0, .17)";
  46. context.beginPath();
  47. 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);
  48. context.closePath();
  49. if (!player.bomb)
  50. context.fill();
  51. context.drawImage(spinBalls, 4 * 40, 0, 40, 40, drawPos.x, drawPos.y, 40 / tagpro.zoom, 40 / tagpro.zoom)
  52. }
  53. }
  54. });
  55. });
  56. }
  57. var source = "("+ MarblesScript + ")()";
  58. var script = document.createElement('script');
  59. script.setAttribute("type", "application/javascript");
  60. script.textContent = source;
  61. document.body.appendChild(script);
Add Comment
Please, Sign In to add comment